- 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)
This commit is contained in:
jkriege2 2019-01-26 13:00:40 +01:00
parent afaee94f7d
commit 0e2237e92f
201 changed files with 6091 additions and 5972 deletions

2
.gitignore vendored
View File

@ -90,3 +90,5 @@ moc_predefs.h
/lib/jkqtplotter/*.TMP
/doc/doxygen_log.txt
/doc/*.tmp
/staticlib/debug/*.prl
/staticlib/release/*.prl

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
doc/images/JKQTPNoError.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -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_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/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_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 |

View File

@ -12,7 +12,7 @@ HEADERS += jkqtfastplotter_test_testmain.h
RCC_DIR = .rccs
CONFIG += qt windows
CONFIG += link_prl qt windows
QT += core gui opengl

View File

@ -36,14 +36,14 @@ TestMain::TestMain(QWidget *parent) :
gl->addWidget(pl1, 0, 0);
JKQTFastPlotter* pl2=new JKQTFastPlotter(w);
pl2->setMaximumWidth(100);
pl2->set_synchronizeY(pl1);
pl2->set_yAxisLabelVisible(false);
pl2->setSynchronizeY(pl1);
pl2->setYAxisLabelVisible(false);
pl2->setPlotBorderLeft(10);
pl2->setPlotBorderRight(2);
w->connect(pl1, SIGNAL(replotting()), pl2, SLOT(redrawPlot()));
gl->addWidget(pl2, 0, 1);
JKQTFastPlotter* pl3=new JKQTFastPlotter(w);
pl3->set_synchronizeX(pl1);
pl3->setSynchronizeX(pl1);
w->connect(pl1, SIGNAL(replotting()), pl3, SLOT(redrawPlot()));
gl->addWidget(pl3, 1, 0);
@ -81,7 +81,7 @@ TestMain::TestMain(QWidget *parent) :
col.setAlpha(127);
JKQTFPimageOverlayPlot* p5o=new JKQTFPimageOverlayPlot(pl3, ovrl, IMAGE_N, IMAGE_N, 0, 10, 0, 10, col);
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"));
pl1->addPlot(p6);
@ -100,14 +100,14 @@ TestMain::TestMain(QWidget *parent) :
QComboBox* spin=new QComboBox(w);
spin->addItems(JKQTFPimagePlot_getPalettes());
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);
scale->addItem("TopLeft");
scale->addItem("TopRight");
scale->addItem("BottomLeft");
scale->addItem("BottomRight");
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"));
@ -126,7 +126,7 @@ TestMain::TestMain(QWidget *parent) :
}
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);
QCheckBox* c=new QCheckBox(tr("red channel"), w);
@ -167,24 +167,24 @@ TestMain::~TestMain() {
void TestMain::enableRed(bool enabled) {
if (enabled) {
prgb->set_imageRed(imageRed, JKQTFP_double);
prgb->setImageRed(imageRed, JKQTFP_double);
} else {
prgb->set_imageRed(NULL, JKQTFP_double);
prgb->setImageRed(NULL, JKQTFP_double);
}
}
void TestMain::enableGreen(bool enabled) {
if (enabled) {
prgb->set_imageGreen(imageGreen, JKQTFP_double);
prgb->setImageGreen(imageGreen, JKQTFP_double);
} else {
prgb->set_imageGreen(NULL, JKQTFP_double);
prgb->setImageGreen(NULL, JKQTFP_double);
}
}
void TestMain::enableBlue(bool enabled) {
if (enabled) {
prgb->set_imageBlue(imageBlue, JKQTFP_double);
prgb->setImageBlue(imageBlue, JKQTFP_double);
} else {
prgb->set_imageBlue(NULL, JKQTFP_double);
prgb->setImageBlue(NULL, JKQTFP_double);
}
}

View File

@ -3,7 +3,7 @@ TEMPLATE = app
SOURCES += jkqtmathtext_simpletest.cpp
CONFIG += qt
CONFIG += link_prl qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

View File

@ -26,7 +26,7 @@ double draw(QPainter& painter, double X, double YY, JKQTMathText& mt, QString na
ht.start();
QSizeF s=mt.getSize(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();
p.setColor("lightcoral");
p.setStyle(Qt::DashLine);
@ -43,7 +43,7 @@ double draw(QPainter& painter, double X, double YY, JKQTMathText& mt, QString na
p.setColor("black");
painter.setPen(p);
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");
painter.setPen(p);
@ -69,15 +69,15 @@ void timingTest(QPainter& painter, QString text, QString name, double fontSize)
double t;
JKQTMathText mt;
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;
sqrsum_parse+=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;
sqrsum_size+=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;
sqrsum_draw+=t*t;
//std::cout<<t<<"\n";
@ -137,24 +137,24 @@ int main(int argc, char* argv[])
bool okh=true;
browser.textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
qDebug()<<"HTML1: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML1: --------------------------------------------- ok="<<okh;
if (mt.get_error_list().size()>0) {
std::cout<<mt.get_error_list().join("\n").toStdString()<<std::endl<<std::endl;
if (mt.getErrorList().size()>0) {
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);
Y+=draw(painter, X1, Y, mt, "math, symbol, 10pt");
mt.setFontSize(20);
Y+=draw(painter, X1, Y, mt, "math, symbol, 20pt");
ht.start();
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>");
qDebug()<<"HTML2: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML2: --------------------------------------------- ok="<<okh;
mt.setFontSize(12);
Y+=draw(painter, X1, Y, mt, "math, XITS, 12pt");
ht.start();
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>");
qDebug()<<"HTML2: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML2: --------------------------------------------- ok="<<okh;
mt.setFontSize(10);
@ -166,19 +166,19 @@ int main(int argc, char* argv[])
mt.useXITS();
ht.start();
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);
Y+=draw(painter, X1, Y, mt, "math, XITS, 10pt");
mt.setFontSize(20);
Y+=draw(painter, X1, Y, mt, "math, XITS, 20pt");
ht.start();
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);
Y+=draw(painter, X1, Y, mt, "math, XITS, 12pt");
ht.start();
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);
Y+=draw(painter, X1, Y, mt, "text, XITS, 10pt");
mt.setFontSize(16);
@ -190,19 +190,19 @@ int main(int argc, char* argv[])
mt.useAnyUnicode("Arial", "Times New Roman");
ht.start();
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);
Y+=draw(painter, X1, Y, mt, "math, Arial Unicode, 10pt");
mt.setFontSize(20);
Y+=draw(painter, X1, Y, mt, "math, Arial Unicode, 20pt");
ht.start();
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);
Y+=draw(painter, X1, Y, mt, "math, Arial Unicode, 12pt");
ht.start();
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);
Y+=draw(painter, X1, Y, mt, "text, Arial Unicode, 10pt");
mt.setFontSize(16);
@ -212,19 +212,19 @@ int main(int argc, char* argv[])
mt.useSTIX();
ht.start();
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);
Y+=draw(painter, X1, Y, mt, "math, STIX, 10pt");
mt.setFontSize(20);
Y+=draw(painter, X1, Y, mt, "math, STIX, 20pt");
ht.start();
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);
Y+=draw(painter, X1, Y, mt, "math, STIX, 12pt");
ht.start();
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);
Y+=draw(painter, X1, Y, mt, "text, STIX, 10pt");
mt.setFontSize(16);

View File

@ -8,7 +8,7 @@ SOURCES += jkqtmathtext_test.cpp \
RCC_DIR = rccs
CONFIG += qt windows
CONFIG += link_prl link_prl qt windows
TARGET = jkqtmathtext_test

View File

@ -156,7 +156,7 @@ double TestForm::draw(QPainter& painter, double X, double YY, JKQTMathText& mt,
ht.start();
QSizeF s=mt.getSize(painter);
Y=Y+mt.getAscent(painter);
durationSizingMS=ht.get_time()/1000.0;
durationSizingMS=ht.getTime()/1000.0;
qDebug()<<" sizing in "<<durationSizingMS<<" ms\n";
QPen p=painter.pen();
p.setColor("lightcoral");
@ -174,7 +174,7 @@ double TestForm::draw(QPainter& painter, double X, double YY, JKQTMathText& mt,
p.setColor("black");
painter.setPen(p);
mt.draw(painter, X, Y, ui->chkBoxes->isChecked());
durationTimingMS=ht.get_time()/1000.0;
durationTimingMS=ht.getTime()/1000.0;
qDebug()<<" drawing in "<<durationTimingMS<<" ms";
p.setColor("blue");
painter.setPen(p);
@ -211,13 +211,13 @@ QTreeWidgetItem *TestForm::createTree(JKQTMathText::MTnode *node, QTreeWidgetIte
else ti=new QTreeWidgetItem(ui->tree);
if (decoN) {
name=QString("MTdecoratedNode: mode='%1'").arg(JKQTMathText::decorationToString(decoN->get_decoration()));
if (decoN->get_child()) ti->addChild(createTree(decoN->get_child(), ti));
name=QString("MTdecoratedNode: mode='%1'").arg(JKQTMathText::decorationToString(decoN->getDecoration()));
if (decoN->getChild()) ti->addChild(createTree(decoN->getChild(), ti));
} else if (matrixN) {
int l=matrixN->getLines();
int c=matrixN->get_columns();
int c=matrixN->getColumns();
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 x=0; x<c; x++) {
if (children[y].at(x)!=nullptr) {
@ -228,36 +228,36 @@ QTreeWidgetItem *TestForm::createTree(JKQTMathText::MTnode *node, QTreeWidgetIte
}
}
} else if (fracN) {
name=QString("MTfracNode: mode='%1'").arg(JKQTMathText::fracModeToString(fracN->get_mode()));
if (fracN->get_child1()) ti->addChild(createTree(fracN->get_child1(), ti));
if (fracN->get_child2()) ti->addChild(createTree(fracN->get_child2(), ti));
name=QString("MTfracNode: mode='%1'").arg(JKQTMathText::fracModeToString(fracN->getMode()));
if (fracN->getChild1()) ti->addChild(createTree(fracN->getChild1(), ti));
if (fracN->getChild2()) ti->addChild(createTree(fracN->getChild2(), ti));
} else if (sqrtN) {
name=QString("MTsqrtNode: deg=%1").arg(sqrtN->get_degree());
if (sqrtN->get_child()) ti->addChild(createTree(sqrtN->get_child(), ti));
name=QString("MTsqrtNode: deg=%1").arg(sqrtN->getDegree());
if (sqrtN->getChild()) ti->addChild(createTree(sqrtN->getChild(), ti));
} else if (braceN) {
name=QString("MTbraceNode: l='%1', r='%2', showR=%3").arg(braceN->get_openbrace()).arg(braceN->get_closebrace()).arg(braceN->getShowRightBrace());
if (braceN->get_child()) ti->addChild(createTree(braceN->get_child(), ti));
name=QString("MTbraceNode: l='%1', r='%2', showR=%3").arg(braceN->getOpenbrace()).arg(braceN->getClosebrace()).arg(braceN->getShowRightBrace());
if (braceN->getChild()) ti->addChild(createTree(braceN->getChild(), ti));
} else if (superN) {
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) {
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) {
name=QString("MTinstruction1Node: \'%1\'").arg(inst1N->get_name());
if (inst1N->get_child()) ti->addChild(createTree(inst1N->get_child(), ti));
name=QString("MTinstruction1Node: \'%1\'").arg(inst1N->getName());
if (inst1N->getChild()) ti->addChild(createTree(inst1N->getChild(), ti));
} else if (lstN) {
name=QString("MTlistNode");
QList<JKQTMathText::MTnode*> list=lstN->get_nodes();
QList<JKQTMathText::MTnode*> list=lstN->getNodes();
for (int i=0; i<list.size(); i++) {
ti->addChild(createTree(list[i], ti));
}
} else if (symN) {
name=QString("MTsymbolNode: \'%1\'").arg(symN->get_symbolName());
name=QString("MTsymbolNode: \'%1\'").arg(symN->getSymbolName());
} else if (spN) {
name=QString("MTwhitespaceNode :\'%1\'").arg(txtN->get_text());
name=QString("MTwhitespaceNode :\'%1\'").arg(txtN->getText());
} else if (txtN) {
name=QString("MTtextNode: \'%1\'").arg(txtN->get_text());
name=QString("MTtextNode: \'%1\'").arg(txtN->getText());
} else {
name=QString("unknown");
@ -341,16 +341,16 @@ void TestForm::updateMath()
ht.start();
double durationParse=0;
if (mt.parse(mathTest)) {
durationParse=ht.get_time()/1000.0;
ui->tree->addTopLevelItem(createTree(mt.get_parsedNode()));
durationParse=ht.getTime()/1000.0;
ui->tree->addTopLevelItem(createTree(mt.getParsedNode()));
} else {
durationParse=ht.get_time()/1000.0;
durationParse=ht.getTime()/1000.0;
}
ui->labParsingTimes->setText(QString(" %1ms").arg(durationParse, 0, 'f', 3));
ui->tree->expandAll();
bool okh=true;
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(",");
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);
if (i==0) {
if (mt.get_error_list().size()>0) {
ui->labError->setText("<span color=\"red\">"+mt.get_error_list().join("<br>")+"</span>");
if (mt.getErrorList().size()>0) {
ui->labError->setText("<span color=\"red\">"+mt.getErrorList().join("<br>")+"</span>");
} else {
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->textBrowser->textCursor().insertHtml("<hr>"+mt.toHtml(&okh)+"<hr><br><br>");
qDebug()<<"HTML: ---------------------------------------------\n"<<mt.toHtml(&okh)<<"\nHTML: --------------------------------------------- ok="<<okh;
if (mt.get_error_list().size()>0) {
qDebug()<<mt.get_error_list().join("\n")<<"\n";
if (mt.getErrorList().size()>0) {
qDebug()<<mt.getErrorList().join("\n")<<"\n";
}
}

View File

@ -22,8 +22,8 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
plotBarchart->getPlotter()->setPlotLabel(tr("\\textbf{bar charts}"));
plotBarchart->setObjectName("plotBarchart");
plotBarchart->getPlotter()->setUserSettigsFilename(QApplication::applicationDirPath()+"/usersettings.ini", "plot_peaks/");
plotBarchart->getPlotter()->getXAxis()->set_labelType(JKQTPCALTdate);
plotBarchart->getPlotter()->getXAxis()->set_tickDateFormat("dd. MMM yyyy");
plotBarchart->getPlotter()->getXAxis()->setLabelType(JKQTPCALTdate);
plotBarchart->getPlotter()->getXAxis()->setTickDateFormat("dd. MMM yyyy");
barchartLayout->addWidget(plotBarchart);
@ -48,23 +48,23 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
size_t bcpye2=plotBarchart->getDatastore()->addCopiedColumn(dataBCYE2, "ye2");
JKQTPBarVerticalErrorGraph* plteBar1=new JKQTPBarVerticalErrorGraph(plotBarchart->getPlotter());
plteBar1->set_title(tr("bars 1"));
plteBar1->set_xColumn(bcpxd);
plteBar1->set_yColumn(bcpy1);
plteBar1->set_yErrorColumn(bcpye1);
plteBar1->set_width(0.45);
plteBar1->set_shift(-0.25);
plteBar1->setTitle(tr("bars 1"));
plteBar1->setXColumn(bcpxd);
plteBar1->setYColumn(bcpy1);
plteBar1->setYErrorColumn(bcpye1);
plteBar1->setWidth(0.45);
plteBar1->setShift(-0.25);
plotBarchart->getPlotter()->addGraph(plteBar1);
JKQTPBarVerticalErrorGraph* plteBar2=new JKQTPBarVerticalErrorGraph(plotBarchart->getPlotter());
plteBar2->set_xColumn(bcpxd);
plteBar2->set_yColumn(bcpy2);
plteBar2->set_yErrorColumn(bcpye2);
plteBar2->set_title(tr("bars 2"));
plteBar2->set_width(0.45);
plteBar2->set_shift(0.25);
plteBar2->set_baseline(0.5);
plteBar2->set_yErrorSymmetric(false);
plteBar2->setXColumn(bcpxd);
plteBar2->setYColumn(bcpy2);
plteBar2->setYErrorColumn(bcpye2);
plteBar2->setTitle(tr("bars 2"));
plteBar2->setWidth(0.45);
plteBar2->setShift(0.25);
plteBar2->setBaseline(0.5);
plteBar2->setYErrorSymmetric(false);
plotBarchart->getPlotter()->addGraph(plteBar2);
plteBar2->autoscaleBarWidthAndShift();
@ -83,22 +83,22 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
barchartLayout->addWidget(plotBarchart2);
JKQTPBarHorizontalErrorGraph* plteBar3=new JKQTPBarHorizontalErrorGraph(plotBarchart2->getPlotter());
plteBar3->set_title(tr("bars 1"));
plteBar3->set_yColumn(bcpx);
plteBar3->set_xColumn(bcpy1);
plteBar3->set_xErrorColumn(bcpye1);
plteBar3->set_width(0.45);
plteBar3->set_shift(-0.25);
plteBar3->setTitle(tr("bars 1"));
plteBar3->setYColumn(bcpx);
plteBar3->setXColumn(bcpy1);
plteBar3->setXErrorColumn(bcpye1);
plteBar3->setWidth(0.45);
plteBar3->setShift(-0.25);
plotBarchart2->getPlotter()->addGraph(plteBar3);
JKQTPBarHorizontalErrorGraph* plteBar4=new JKQTPBarHorizontalErrorGraph(plotBarchart2->getPlotter());
plteBar4->set_yColumn(bcpx);
plteBar4->set_xColumn(bcpy2);
plteBar4->set_xErrorColumn(bcpye2);
plteBar4->set_title(tr("bars 2"));
plteBar4->set_width(0.45);
plteBar4->set_shift(0.25);
plteBar4->set_xErrorSymmetric(false);
plteBar4->setYColumn(bcpx);
plteBar4->setXColumn(bcpy2);
plteBar4->setXErrorColumn(bcpye2);
plteBar4->setTitle(tr("bars 2"));
plteBar4->setWidth(0.45);
plteBar4->setShift(0.25);
plteBar4->setXErrorSymmetric(false);
plotBarchart2->getPlotter()->addGraph(plteBar4);
plteBar4->autoscaleBarWidthAndShift(0.9, 1);
@ -134,22 +134,22 @@ TestWidgetBarcharts::TestWidgetBarcharts(QWidget *parent) :
void TestWidgetBarcharts::setBarchartLogLog(bool checked)
{
plotBarchart->getXAxis()->set_logAxis(checked);
plotBarchart->getYAxis()->set_logAxis(checked);
plotBarchart->getXAxis()->setLogAxis(checked);
plotBarchart->getYAxis()->setLogAxis(checked);
plotBarchart->zoomToFit();
plotBarchart2->getXAxis()->set_logAxis(checked);
plotBarchart2->getYAxis()->set_logAxis(checked);
plotBarchart2->getXAxis()->setLogAxis(checked);
plotBarchart2->getYAxis()->setLogAxis(checked);
plotBarchart2->zoomToFit();
}
void TestWidgetBarcharts::setBarchartAngele(int angle)
{
plotBarchart->getXAxis()->set_tickLabelAngle(angle);
plotBarchart->getXAxis()->set_drawMode2(JKQTPCADMcomplete);
plotBarchart->getXAxis()->setTickLabelAngle(angle);
plotBarchart->getXAxis()->setDrawMode2(JKQTPCADMcomplete);
}
void TestWidgetBarcharts::setBarchartAngele2(int angle)
{
plotBarchart->getYAxis()->set_tickLabelAngle(angle);
plotBarchart->getYAxis()->set_drawMode2(JKQTPCADMcomplete);
plotBarchart->getYAxis()->setTickLabelAngle(angle);
plotBarchart->getYAxis()->setDrawMode2(JKQTPCADMcomplete);
}

View File

@ -63,29 +63,29 @@ TestWidgetContourPlots::TestWidgetContourPlots(QWidget *parent) :
// size_t colContour=plotContour->getDatastore()->addCopiedImageAsColumnTranspose(histAlex.data(), histAlexNx, histAlexNy, tr("2Dhist"));
JKQTPColumnMathImage* densityplot=new JKQTPColumnMathImage(plotDensity->getPlotter());
densityplot->set_x(-0.1);
densityplot->set_y(-0.1);
densityplot->set_width(1.1);
densityplot->set_height(1.1);
densityplot->set_Nx(histAlexNx);
densityplot->set_Ny(histAlexNy);
densityplot->set_palette(JKQTPMathImageINVERTED_OCEAN);
densityplot->set_imageColumn(colHist2D);
densityplot->set_infColor(Qt::transparent);
densityplot->set_nanColor(Qt::transparent);
densityplot->set_title("density plot");
densityplot->setX(-0.1);
densityplot->setY(-0.1);
densityplot->setWidth(1.1);
densityplot->setHeight(1.1);
densityplot->setNx(histAlexNx);
densityplot->setNy(histAlexNy);
densityplot->setPalette(JKQTPMathImageINVERTED_OCEAN);
densityplot->setImageColumn(colHist2D);
densityplot->setInfColor(Qt::transparent);
densityplot->setNanColor(Qt::transparent);
densityplot->setTitle("density plot");
plotDensity->addGraph(densityplot);
densityplot=new JKQTPColumnMathImage(plotContour->getPlotter());
densityplot->set_x(-0.1);
densityplot->set_y(-0.1);
densityplot->set_width(1.1);
densityplot->set_height(1.1);
densityplot->set_Nx(histAlexNx);
densityplot->set_Ny(histAlexNy);
densityplot->set_palette(JKQTPMathImageINVERTED_OCEAN);
densityplot->set_imageColumn(colHist2D);
densityplot->set_title("density plot");
densityplot->setX(-0.1);
densityplot->setY(-0.1);
densityplot->setWidth(1.1);
densityplot->setHeight(1.1);
densityplot->setNx(histAlexNx);
densityplot->setNy(histAlexNy);
densityplot->setPalette(JKQTPMathImageINVERTED_OCEAN);
densityplot->setImageColumn(colHist2D);
densityplot->setTitle("density plot");
plotContour->addGraph(densityplot);
plotContour->setGrid(false);
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<<4<<5<<9<<14;
JKQTPContour* cp=new JKQTPContour(plotContour->getPlotter());
cp->set_x(-0.1);
cp->set_y(-0.1);
cp->set_width(1.1);
cp->set_height(1.1);
cp->set_Nx(histAlexNx);
cp->set_Ny(histAlexNy);
cp->set_imageColumn(colHist2D);
// cp->set_palette(JKQTPMathImageINVERTED_OCEAN);
cp->set_contourLevels(levels);
cp->set_title("contour plot");
cp->setX(-0.1);
cp->setY(-0.1);
cp->setWidth(1.1);
cp->setHeight(1.1);
cp->setNx(histAlexNx);
cp->setNy(histAlexNy);
cp->setImageColumn(colHist2D);
// cp->setPalette(JKQTPMathImageINVERTED_OCEAN);
cp->setContourLevels(levels);
cp->setTitle("contour plot");
plotContour->addGraph(cp);
plotContour->zoom(-0.1,1.1,-0.1,1.1);

View File

@ -21,10 +21,10 @@ TestWidgetEmptyPlot::TestWidgetEmptyPlot(QWidget *parent) :
xef[i]=i;
efy[i]=double(i%5)*1e-308;
}
efunc->set_xColumn(plotEmpty->getDatastore()->addCopiedColumn(xef, NEMPTY, "x"));
efunc->set_yColumn(plotEmpty->getDatastore()->addCopiedColumn(efy, NEMPTY, "y"));
efunc->setXColumn(plotEmpty->getDatastore()->addCopiedColumn(xef, NEMPTY, "x"));
efunc->setYColumn(plotEmpty->getDatastore()->addCopiedColumn(efy, NEMPTY, "y"));
plotEmpty->addGraph(efunc);
plotEmpty->getYAxis()->set_logAxis(true);
plotEmpty->getYAxis()->setLogAxis(true);
plotEmpty->zoomToFit();
plotEmpty->setY(0,0);

View File

@ -19,10 +19,10 @@ TestWidgetFunctionPlots::TestWidgetFunctionPlots(QWidget *parent) :
plotFuncPlt=new JKQTPlotter(true, this);
plotFuncLayout->addWidget(plotFuncPlt);
pfunc=new JKQTPXParsedFunctionLineGraph(plotFuncPlt->getPlotter());
pfunc->set_function("x^2/10+sin(x*pi*10)");
pfunc->set_errorFunction("x^2/20");
pfunc->set_drawErrorPolygons(true);
pfunc->set_style(Qt::DashLine);
pfunc->setFunction("x^2/10+sin(x*pi*10)");
pfunc->setErrorFunction("x^2/20");
pfunc->setDrawErrorPolygons(true);
pfunc->setStyle(Qt::DashLine);
plotFuncPlt->addGraph(pfunc);
plotFuncPlt->redrawPlot();
@ -38,17 +38,17 @@ TestWidgetFunctionPlots::TestWidgetFunctionPlots(QWidget *parent) :
plotFuncLayout->addWidget(chkPFuncDrawLine);
connect(chkPFuncDrawLine, SIGNAL(toggled(bool)), this, SLOT(setPFuncStyle()));
QSpinBox* spinPFunc=new QSpinBox(this);
spinPFunc->setValue(pfunc->get_minSamples());
spinPFunc->setValue(pfunc->getMinSamples());
plotFuncLayout->addWidget(new QLabel(tr("min samples:"), this));
plotFuncLayout->addWidget(spinPFunc);
connect(spinPFunc, SIGNAL(valueChanged(int)), this, SLOT(setPFuncMinPoint(int)));
spinPFunc=new QSpinBox(this);
spinPFunc->setValue(pfunc->get_maxRefinementDegree());
spinPFunc->setValue(pfunc->getMaxRefinementDegree());
plotFuncLayout->addWidget(new QLabel(tr("max refinement degree:"), this));
plotFuncLayout->addWidget(spinPFunc);
connect(spinPFunc, SIGNAL(valueChanged(int)), this, SLOT(setPFuncMaxRefine(int)));
QComboBox* edtPFunc=new QComboBox(this);
edtPFunc->addItem(pfunc->get_function());
edtPFunc->addItem(pfunc->getFunction());
edtPFunc->addItem("x");
edtPFunc->addItem("x^2");
edtPFunc->addItem("x^2-x^3");
@ -58,7 +58,7 @@ TestWidgetFunctionPlots::TestWidgetFunctionPlots(QWidget *parent) :
plotFuncLayout->addWidget(edtPFunc);
connect(edtPFunc, SIGNAL(currentIndexChanged(QString)), this, SLOT(setPFunc(QString)));
edtPFunc=new QComboBox(this);
edtPFunc->addItem(pfunc->get_errorFunction());
edtPFunc->addItem(pfunc->getErrorFunction());
edtPFunc->addItem("");
edtPFunc->addItem("x");
edtPFunc->addItem("cos(x)");
@ -69,11 +69,11 @@ TestWidgetFunctionPlots::TestWidgetFunctionPlots(QWidget *parent) :
connect(edtPFunc, SIGNAL(currentIndexChanged(QString)), this, SLOT(setPFuncE(QString)));
QCheckBox* chkFLogX=new QCheckBox(tr("x-axis: log-scale"));
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);
QCheckBox* chkFLogY=new QCheckBox(tr("y-axis: log-scale"));
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);
@ -82,35 +82,35 @@ TestWidgetFunctionPlots::TestWidgetFunctionPlots(QWidget *parent) :
void TestWidgetFunctionPlots::setPFuncStyle()
{
pfunc->set_drawErrorLines(false);
pfunc->set_drawErrorPolygons(false);
if (pfuncErrorStyle->getErrorStyle()==JKQTPErrorLines) pfunc->set_drawErrorLines(true);
if (pfuncErrorStyle->getErrorStyle()==JKQTPErrorPolygons) pfunc->set_drawErrorPolygons(true);
pfunc->set_drawLine(chkPFuncDrawLine->isChecked());
pfunc->set_displaySamplePoints(chkPFuncDrawSamples->isChecked());
pfunc->setDrawErrorLines(false);
pfunc->setDrawErrorPolygons(false);
if (pfuncErrorStyle->getErrorStyle()==JKQTPErrorLines) pfunc->setDrawErrorLines(true);
if (pfuncErrorStyle->getErrorStyle()==JKQTPErrorPolygons) pfunc->setDrawErrorPolygons(true);
pfunc->setDrawLine(chkPFuncDrawLine->isChecked());
pfunc->setDisplaySamplePoints(chkPFuncDrawSamples->isChecked());
plotFuncPlt->redrawPlot();
}
void TestWidgetFunctionPlots::setPFuncMinPoint(int value)
{
pfunc->set_minSamples(value);
pfunc->setMinSamples(value);
plotFuncPlt->redrawPlot();
}
void TestWidgetFunctionPlots::setPFuncMaxRefine(int value)
{
pfunc->set_maxRefinementDegree(value);
pfunc->setMaxRefinementDegree(value);
plotFuncPlt->redrawPlot();
}
void TestWidgetFunctionPlots::setPFunc(const QString &expression)
{
pfunc->set_function(expression);
pfunc->setFunction(expression);
plotFuncPlt->redrawPlot();
}
void TestWidgetFunctionPlots::setPFuncE(const QString &expression)
{
pfunc->set_errorFunction(expression);
pfunc->setErrorFunction(expression);
plotFuncPlt->redrawPlot();
}

View File

@ -22,8 +22,8 @@ TestWidgetGeometry::TestWidgetGeometry(QWidget *parent) :
plotGeo->setXY(0,1,0,1);
plotGeo->getPlotter()->getXAxis()->setAxisLabel("$x$ [mm]");
plotGeo->getPlotter()->getYAxis()->setAxisLabel("$y$ [mm]");
/*plotGeo->getPlotter()->getXAxis()->set_linkedAxis(plotGeo->getPlotter()->getYAxis());
plotGeo->getPlotter()->getXAxis()->set_changeWidthToAspectRatio(true);*/
/*plotGeo->getPlotter()->getXAxis()->setLinkedAxis(plotGeo->getPlotter()->getYAxis());
plotGeo->getPlotter()->getXAxis()->setChangeWidthToAspectRatio(true);*/
plotGeo->getPlotter()->setMaintainAspectRatio(true);
plotGeo->getPlotter()->setAspectRatio(1);
plotGeo->getPlotter()->setMaintainAxisAspectRatio(true);
@ -36,16 +36,16 @@ TestWidgetGeometry::TestWidgetGeometry(QWidget *parent) :
//plotGeo->getPlotter()->addGraph(line2);
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);
JKQTPGeoRectangle* rect2=new JKQTPGeoRectangle(plotGeo->getPlotter(), 1,1,2,2, QColor("red"),2);
rect2->set_angle(45);
rect2->setAngle(45);
//plotGeo->getPlotter()->addGraph(rect2);
JKQTPGeoRectangle* rect3=new JKQTPGeoRectangle(plotGeo->getPlotter(), 1,1,2,4, QColor("green"),2);
rect3->set_angle(-30);
rect3->setAngle(-30);
//plotGeo->getPlotter()->addGraph(rect3);
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);
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);
plotGeo->getPlotter()->addGraph(iline2);
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);
JKQTPGeoText* text=new JKQTPGeoText(plotGeo->getPlotter(), -1, -1, "Test $f(x)=\\sqrt{\\sin(x^2)}$ \\textbf{bold}", 12, QColor("red"));

View File

@ -107,7 +107,7 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
size_t id=plot->getPlotter()->addGraph(cx2, cy21, "$5\\cdot\\sin(x)$", JKQTPFilledCurveX);
JKQTPFilledCurveXGraph* fcxgr=qobject_cast<JKQTPFilledCurveXGraph*>(plot->getPlotter()->getGraph(id));
if (fcxgr) {
fcxgr->set_baseline(2);
fcxgr->setBaseline(2);
}
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);
pltePlot2=new JKQTPXYLineErrorGraph(plotBot->getPlotter());
pltePlot2->set_xColumn(cx2r);
pltePlot2->set_yColumn(cy21r);
pltePlot2->set_title(tr("random numbers"));
pltePlot2->set_drawLine(true);
pltePlot2->set_yErrorColumn(cy21re);
pltePlot2->set_yErrorStyle(JKQTPErrorBarsPolygons);
pltePlot2->set_symbol(JKQTPFilledStar);
pltePlot2->setXColumn(cx2r);
pltePlot2->setYColumn(cy21r);
pltePlot2->setTitle(tr("random numbers"));
pltePlot2->setDrawLine(true);
pltePlot2->setYErrorColumn(cy21re);
pltePlot2->setYErrorStyle(JKQTPErrorBarsPolygons);
pltePlot2->setSymbol(JKQTPFilledStar);
plotBot->getPlotter()->addGraph(pltePlot2);
plotBot->zoomToFit();
@ -165,50 +165,50 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
plot->getPlotter()->addVerticalBargraph(cb, cbp, ts);
JKQTPVerticalRange* r1=new JKQTPVerticalRange(plot->getPlotter());
r1->set_rangeMin(5);
r1->set_rangeMax(10);
r1->set_rangeCenter(7.5);
r1->set_title("vert. range");
r1->setRangeMin(5);
r1->setRangeMax(10);
r1->setRangeCenter(7.5);
r1->setTitle("vert. range");
plot->getPlotter()->addGraph(r1);
JKQTPHorizontalRange* r2=new JKQTPHorizontalRange(plot->getPlotter());
r2->set_rangeMin(5);
r2->set_rangeMax(10);
r2->set_rangeCenter(7.5);
r2->set_title("hor. range");
r2->setRangeMin(5);
r2->setRangeMax(10);
r2->setRangeCenter(7.5);
r2->setTitle("hor. range");
plot->getPlotter()->addGraph(r2);
JKQTPBoxplotVerticalGraph* box=new JKQTPBoxplotVerticalGraph(plotBot2->getPlotter());
box->set_posColumn(cbxbox);
box->set_medianColumn(cbmed);
box->set_meanColumn(cbmean);
box->set_minColumn(cbmin);
box->set_maxColumn(cbmax);
box->set_percentile25Column(cbp25);
box->set_percentile75Column(cbp75);
box->set_title("Boxplot");
box->setPosColumn(cbxbox);
box->setMedianColumn(cbmed);
box->setMeanColumn(cbmean);
box->setMinColumn(cbmin);
box->setMaxColumn(cbmax);
box->setPercentile25Column(cbp25);
box->setPercentile75Column(cbp75);
box->setTitle("Boxplot");
plotBot2->addGraph(box);
plotBot2->zoomToFit();
/*JKQTPYFunctionLineGraph* g=new JKQTPYFunctionLineGraph(&plot);
g->set_title("function 1");
g->setTitle("function 1");
g->setPlotFunction(f1);
g->set_errorFunction(f1e);
g->set_drawErrorLines(true);
g->set_drawErrorPolygons(false);
g->set_color(QColor("red"));
g->setErrorFunction(f1e);
g->setDrawErrorLines(true);
g->setDrawErrorPolygons(false);
g->setColor(QColor("red"));
plot->addGraph(g);*/
/*JKQTPXFunctionLineGraph* g=new JKQTPXFunctionLineGraph(&plot);
g->set_title("function 2");
g->setTitle("function 2");
g->setPlotFunction(f2);
plot->addGraph(g);*/
/*JKQTPStepVerticalGraph* g=new JKQTPStepVerticalGraph(&plot);
g->set_xColumn(cy11);
g->set_yColumn(cx1);
g->set_fillCurve(true);
g->set_valuesCentered(true);
g->setXColumn(cy11);
g->setYColumn(cx1);
g->setFillCurve(true);
g->setValuesCentered(true);
plot->addGraph(g);
plot->addGraph(cy11, cx1, "$\\sin(x)$", JKQTPPoints);*/
@ -218,16 +218,16 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
QCheckBox* chklogX=new QCheckBox("logarithmic X-axis", this);
QCheckBox* chklogY=new QCheckBox("logarithmic Y-axis", this);
connect(chklogX, SIGNAL(toggled(bool)), plot->getPlotter()->getXAxis(), SLOT(set_logAxis(bool)));
connect(chklogY, SIGNAL(toggled(bool)), plot->getPlotter()->getYAxis(), SLOT(set_logAxis(bool)));
connect(chklogX, SIGNAL(toggled(bool)), plotBot2->getPlotter()->getXAxis(), SLOT(set_logAxis(bool)));
connect(chklogY, SIGNAL(toggled(bool)), plotBot2->getPlotter()->getYAxis(), SLOT(set_logAxis(bool)));
connect(chklogX, SIGNAL(toggled(bool)), plot->getPlotter()->getXAxis(), SLOT(setLogAxis(bool)));
connect(chklogY, SIGNAL(toggled(bool)), plot->getPlotter()->getYAxis(), SLOT(setLogAxis(bool)));
connect(chklogX, SIGNAL(toggled(bool)), plotBot2->getPlotter()->getXAxis(), SLOT(setLogAxis(bool)));
connect(chklogY, SIGNAL(toggled(bool)), plotBot2->getPlotter()->getYAxis(), SLOT(setLogAxis(bool)));
layout->addWidget(chklogX);
layout->addWidget(chklogY);
QCheckBox* chkInvertX=new QCheckBox("invert X-axis", this);
QCheckBox* chkInvertY=new QCheckBox("invert Y-axis", this);
connect(chkInvertX, SIGNAL(toggled(bool)), plot->getPlotter()->getXAxis(), SLOT(set_inverted(bool)));
connect(chkInvertY, SIGNAL(toggled(bool)), plot->getPlotter()->getYAxis(), SLOT(set_inverted(bool)));
connect(chkInvertX, SIGNAL(toggled(bool)), plot->getPlotter()->getXAxis(), SLOT(setInverted(bool)));
connect(chkInvertY, SIGNAL(toggled(bool)), plot->getPlotter()->getYAxis(), SLOT(setInverted(bool)));
layout->addWidget(chkInvertX);
layout->addWidget(chkInvertY);
layout->addWidget(chkInvertX);
@ -285,12 +285,12 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
}
void TestWidgetGraphs::moveovl() {
ovl1->set_position(ovl1->get_position()+0.1);
if (ovl1->get_position()>30) ovl1->set_position(0);
ovl1->setPosition(ovl1->getPosition()+0.1);
if (ovl1->getPosition()>30) ovl1->setPosition(0);
ovlCnt++;
if (ovlCnt>20) {
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;
ovlTime.start();
}
@ -307,10 +307,10 @@ void TestWidgetGraphs::setErrorStyle(int /*index*/)
// JKQTPXGraphErrors* ex=dynamic_cast<JKQTPXGraphErrors*>(plteErrors);
JKQTPYGraphErrors* ey=dynamic_cast<JKQTPYGraphErrors*>(plteErrors);
if (exy) {
exy->set_yErrorStyle(String2JKQTPErrorPlotstyle(cmb->itemData(cmb->currentIndex()).toString()));
exy->setYErrorStyle(String2JKQTPErrorPlotstyle(cmb->itemData(cmb->currentIndex()).toString()));
}
if (ey) {
ey->set_yErrorStyle(String2JKQTPErrorPlotstyle(cmb->itemData(cmb->currentIndex()).toString()));
ey->setYErrorStyle(String2JKQTPErrorPlotstyle(cmb->itemData(cmb->currentIndex()).toString()));
}
plot->redrawPlot();
}
@ -322,7 +322,7 @@ void TestWidgetGraphs::setESSymbol(int /*index*/)
if (cmb) {
JKQTPXYLineGraph* exy=dynamic_cast<JKQTPXYLineGraph*>(plteSymbols);
if (exy) {
exy->set_symbol(String2JKQTPGraphSymbols(cmb->itemData(cmb->currentIndex()).toString()));
exy->setSymbol(String2JKQTPGraphSymbols(cmb->itemData(cmb->currentIndex()).toString()));
}
plot->redrawPlot();
@ -332,9 +332,9 @@ void TestWidgetGraphs::setESSymbol(int /*index*/)
void TestWidgetGraphs::setSortOrder2(int index)
{
if (index==0) pltePlot2->set_sortData(JKQTPXYGraph::Unsorted);
if (index==1) pltePlot2->set_sortData(JKQTPXYLineGraph::SortedX);
if (index==2) pltePlot2->set_sortData(JKQTPXYLineGraph::SortedY);
if (index==0) pltePlot2->setSortData(JKQTPXYGraph::Unsorted);
if (index==1) pltePlot2->setSortData(JKQTPXYLineGraph::SortedX);
if (index==2) pltePlot2->setSortData(JKQTPXYLineGraph::SortedY);
plotBot->redrawPlot();
}

View File

@ -29,8 +29,8 @@ TestWidgetImages::TestWidgetImages(QWidget *parent) :
plotImg->getPlotter()->setAspectRatio(3.0/2.0);
plotImg->getPlotter()->setMaintainAxisAspectRatio(true);
plotImg->getPlotter()->setAxisAspectRatio(4.0);
/*plotImg->getPlotter()->getXAxis()->set_linkedAxis(plotImg->getPlotter()->getYAxis());
plotImg->getPlotter()->getXAxis()->set_changeWidthToAspectRatio(true);
/*plotImg->getPlotter()->getXAxis()->setLinkedAxis(plotImg->getPlotter()->getYAxis());
plotImg->getPlotter()->getXAxis()->setChangeWidthToAspectRatio(true);
plotImg->getPlotter()->getXAxis()->setAspectRatio(1.0);*/
@ -39,7 +39,7 @@ TestWidgetImages::TestWidgetImages(QWidget *parent) :
plotImg->setAbsoluteXY(0,30,0,20);
img1=QImage(":/lena.png");
JKQTPImage* pimg1=new JKQTPImage(0,0,10,20, &img1, plotImg->getPlotter());
pimg1->set_title("LENA");
pimg1->setTitle("LENA");
plotImg->getPlotter()->addGraph(pimg1);
double* img2=(double*)calloc(100*100,sizeof(double));
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->set_imageMin(-1);
pimg2->set_imageMax(0.5);
pimg2->set_imageName("left image");
pimg2->set_title("left image");
pimg2->set_autoImageRange(false);
pimg2->set_colorBarTopVisible(true);
pimg2->set_colorBarRightVisible(false);
pimg2->setImageMin(-1);
pimg2->setImageMax(0.5);
pimg2->setImageName("left image");
pimg2->setTitle("left image");
pimg2->setAutoImageRange(false);
pimg2->setColorBarTopVisible(true);
pimg2->setColorBarRightVisible(false);
plotImg->getPlotter()->addGraph(pimg2);
pimg3=new JKQTPMathImage(20,0,10,10, JKQTPMathImageBase::DoubleArray, img2, 100, 100, JKQTPMathImageMATLAB, plotImg->getPlotter());
pimg3->set_colorBarTopVisible(true);
pimg3->set_colorBarRightVisible(true);
pimg3->set_imageMax(0.5);
pimg3->set_rangeMaxFailAction(JKQTPMathImageGivenColor);
pimg3->set_rangeMaxFailColor(QColor("salmon"));
pimg3->set_imageMin(-0.3);
pimg3->set_rangeMinFailAction(JKQTPMathImageTransparent);
pimg3->set_autoImageRange(false);
pimg3->set_imageName("I(x,y)=\\sin\\left(\\frac{2\\pi\\cdot\\sqrt{1+x^2+y^2}}{20}\\right)");
pimg3->set_dataModifier(img2M, JKQTPMathImageBase::Int32Array);
pimg3->set_modifierMode(JKQTPMathImageBase::ModifyNone);
pimg3->set_title("right image");
pimg3->setColorBarTopVisible(true);
pimg3->setColorBarRightVisible(true);
pimg3->setImageMax(0.5);
pimg3->setRangeMaxFailAction(JKQTPMathImageGivenColor);
pimg3->setRangeMaxFailColor(QColor("salmon"));
pimg3->setImageMin(-0.3);
pimg3->setRangeMinFailAction(JKQTPMathImageTransparent);
pimg3->setAutoImageRange(false);
pimg3->setImageName("I(x,y)=\\sin\\left(\\frac{2\\pi\\cdot\\sqrt{1+x^2+y^2}}{20}\\right)");
pimg3->setDataModifier(img2M, JKQTPMathImageBase::Int32Array);
pimg3->setModifierMode(JKQTPMathImageBase::ModifyNone);
pimg3->setTitle("right image");
plotImg->getPlotter()->addGraph(pimg3);
QColor ty=QColor("blue");
ty.setAlphaF(0.1);
JKQTPOverlayImage* oimg1=new JKQTPOverlayImage(10,0,10,10, bimg2, 100, 100, QColor("blue"), plotImg->getPlotter());
oimg1->set_title("overlay");
oimg1->set_falseColor(ty);
oimg1->setTitle("overlay");
oimg1->setFalseColor(ty);
plotImg->getPlotter()->addGraph(oimg1);
JKQTPOverlayImageEnhanced* oimg2=new JKQTPOverlayImageEnhanced(10,0,10,10, bimg2, 100, 100, QColor("red"), plotImg->getPlotter());
oimg2->set_title("enhanced overlay");
oimg2->set_drawAsRectangles(false);
oimg2->setTitle("enhanced overlay");
oimg2->setDrawAsRectangles(false);
plotImg->getPlotter()->addGraph(oimg2);
plotImg->setPlotUpdateEnabled(true);
@ -116,18 +116,18 @@ TestWidgetImages::TestWidgetImages(QWidget *parent) :
void TestWidgetImages::setImgPalette(int index)
{
pimg3->set_palette(index);
pimg3->setPalette(index);
plotImg->redrawPlot();
}
void TestWidgetImages::setImgPalette1(int index)
{
pimg2->set_palette(index);
pimg2->setPalette(index);
plotImg->redrawPlot();
}
void TestWidgetImages::setImgModifier(int index)
{
pimg3->set_modifierMode(JKQTPMathImage::ModifierMode(index));
pimg3->setModifierMode(JKQTPMathImage::ModifierMode(index));
plotImg->redrawPlot();
}

View File

@ -47,64 +47,64 @@ TestWidgetLogGraphs::TestWidgetLogGraphs(QWidget *parent) :
QCheckBox* chklogX=new QCheckBox("logarithmic X-axis", this);
QCheckBox* chklogY=new QCheckBox("logarithmic Y-axis", this);
connect(chklogX, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getXAxis(), SLOT(set_logAxis(bool)));
connect(chklogY, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getYAxis(), SLOT(set_logAxis(bool)));
connect(chklogX, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getXAxis(), SLOT(setLogAxis(bool)));
connect(chklogY, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getYAxis(), SLOT(setLogAxis(bool)));
layWid->addWidget(chklogX);
layWid->addWidget(chklogY);
QCheckBox* chkXMinorTicks=new QCheckBox("minor X-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(chkYMinorTicks, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getYAxis(), SLOT(set_minorTickLabelsEnabled(bool)));
connect(chkXMinorTicks, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getXAxis(), SLOT(setMinorTickLabelsEnabled(bool)));
connect(chkYMinorTicks, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getYAxis(), SLOT(setMinorTickLabelsEnabled(bool)));
layWid->addWidget(chkXMinorTicks);
layWid->addWidget(chkYMinorTicks);
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()->getYAxis(), SLOT(set_minorTickLabelFullNumber(bool)));
connect(chkFullNumberMinor, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getXAxis(), SLOT(setMinorTickLabelFullNumber(bool)));
connect(chkFullNumberMinor, SIGNAL(toggled(bool)), plotLOG->getPlotter()->getYAxis(), SLOT(setMinorTickLabelFullNumber(bool)));
layWid->addWidget(chkFullNumberMinor);
QComboBox* cmbTickMode=new QComboBox(this);
cmbTickMode->addItem("JKQTPLTMLinOrLog");
cmbTickMode->addItem("JKQTPLTMLin");
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);
cmbTickMode=new QComboBox(this);
cmbTickMode->addItem("JKQTPLTMLinOrLog");
cmbTickMode->addItem("JKQTPLTMLin");
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);
cmbTickMode->setCurrentIndex(0);
plotLOG->getPlotter()->getYAxis()->set_tickMode(JKQTPLTMLinOrPower);
plotLOG->getPlotter()->getYAxis()->set_minorTicks(1);
plotLOG->getPlotter()->getYAxis()->setTickMode(JKQTPLTMLinOrPower);
plotLOG->getPlotter()->getYAxis()->setMinorTicks(1);
plotLOG->getPlotter()->getYAxis()->set_drawMode2(JKQTPCADMcomplete);
plotLOG->getPlotter()->getXAxis()->set_drawMode2(JKQTPCADMcomplete);
plotLOG->getPlotter()->getYAxis()->setDrawMode2(JKQTPCADMcomplete);
plotLOG->getPlotter()->getXAxis()->setDrawMode2(JKQTPCADMcomplete);
QSpinBox* spinMinTicks=new QSpinBox(this);
spinMinTicks->setRange(0,999);
connect(spinMinTicks, SIGNAL(valueChanged(int)), plotLOG->getPlotter()->getXAxis(), SLOT(set_minorTicks(int)));
connect(spinMinTicks, SIGNAL(valueChanged(int)), plotLOG->getPlotter()->getYAxis(), SLOT(set_minorTicks(int)));
connect(spinMinTicks, SIGNAL(valueChanged(int)), plotLOG->getPlotter()->getXAxis(), SLOT(setMinorTicks(int)));
connect(spinMinTicks, SIGNAL(valueChanged(int)), plotLOG->getPlotter()->getYAxis(), SLOT(setMinorTicks(int)));
layWid->addRow("X/Y-axis minor tick count", spinMinTicks);
spinMinTicks->setValue(1);
QDoubleSpinBox* spinLOGAngle=new QDoubleSpinBox(this);
spinLOGAngle->setRange(-90,90);
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);
spinLOGAngle->setValue(0);
spinLOGAngle=new QDoubleSpinBox(this);
spinLOGAngle->setRange(-90,90);
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);
spinLOGAngle->setValue(0);

View File

@ -51,29 +51,29 @@ TestWidgetParamScatterPlots::TestWidgetParamScatterPlots(QWidget *parent) :
int pspsy=plotPSP->getDatastore()->addCopiedColumn(dataSy, "symbol");
pltePSPCol=new JKQTPXYParametrizedErrorScatterGraph(plotPSP->getPlotter());
pltePSPCol->set_title(tr("changing color"));
pltePSPCol->set_xColumn(pspx);
pltePSPCol->set_yColumn(pspy);
pltePSPCol->set_colorColumn(pspc);
pltePSPCol->set_yErrorColumn(pspy1);
pltePSPCol->set_yErrorColumnLower(pspy2);
pltePSPCol->set_yErrorSymmetric(true);
pltePSPCol->set_drawLine(true);
pltePSPCol->setTitle(tr("changing color"));
pltePSPCol->setXColumn(pspx);
pltePSPCol->setYColumn(pspy);
pltePSPCol->setColorColumn(pspc);
pltePSPCol->setYErrorColumn(pspy1);
pltePSPCol->setYErrorColumnLower(pspy2);
pltePSPCol->setYErrorSymmetric(true);
pltePSPCol->setDrawLine(true);
plotPSP->getPlotter()->addGraph(pltePSPCol);
pltePSPSize=new JKQTPXYParametrizedScatterGraph(plotPSP->getPlotter());
pltePSPSize->set_xColumn(pspx);
pltePSPSize->set_yColumn(pspy1);
pltePSPSize->set_sizeColumn(psps);
pltePSPSize->set_title(tr("changing size"));
pltePSPSize->setXColumn(pspx);
pltePSPSize->setYColumn(pspy1);
pltePSPSize->setSizeColumn(psps);
pltePSPSize->setTitle(tr("changing size"));
plotPSP->getPlotter()->addGraph(pltePSPSize);
pltePSPSymb=new JKQTPXYParametrizedScatterGraph(plotPSP->getPlotter());
pltePSPSymb->set_xColumn(pspx);
pltePSPSymb->set_yColumn(pspy3);
pltePSPSymb->set_symbolColumn(pspsy);
pltePSPSymb->set_title(tr("changing symbol"));
pltePSPSymb->setXColumn(pspx);
pltePSPSymb->setYColumn(pspy3);
pltePSPSymb->setSymbolColumn(pspsy);
pltePSPSymb->setTitle(tr("changing symbol"));
plotPSP->getPlotter()->addGraph(pltePSPSymb);
plotPSP->setPlotUpdateEnabled(true);
@ -95,6 +95,6 @@ TestWidgetParamScatterPlots::TestWidgetParamScatterPlots(QWidget *parent) :
void TestWidgetParamScatterPlots::setPSPSymmErrors(bool checked)
{
pltePSPCol->set_yErrorSymmetric(checked);
pltePSPCol->setYErrorSymmetric(checked);
plotPSP->redrawPlot();
}

View File

@ -45,10 +45,10 @@ TestWidgetPeaksPlots::TestWidgetPeaksPlots(QWidget *parent) :
int phot2=plotPeaks->getDatastore()->addCopiedColumn(photons2, "photons 2");
graphPeakStream1=new JKQTPPeakStreamGraph(phot1, 0.05, 1, QColor("darkgreen"), plotPeaks->getPlotter());
graphPeakStream1->set_title("channel 1");
graphPeakStream1->setTitle("channel 1");
plotPeaks->getPlotter()->addGraph(graphPeakStream1);
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->setPlotUpdateEnabled(true);
@ -63,14 +63,14 @@ TestWidgetPeaksPlots::TestWidgetPeaksPlots(QWidget *parent) :
void TestWidgetPeaksPlots::setDrawBaseline(bool checked)
{
graphPeakStream1->set_drawBaseline(checked);
graphPeakStream2->set_drawBaseline(checked);
graphPeakStream1->setDrawBaseline(checked);
graphPeakStream2->setDrawBaseline(checked);
plotPeaks->redrawPlot();
}
void TestWidgetPeaksPlots::setYPeaks(bool checked)
{
graphPeakStream1->set_yPeaks(checked);
graphPeakStream2->set_yPeaks(checked);
graphPeakStream1->setYPeaks(checked);
graphPeakStream2->setYPeaks(checked);
plotPeaks->redrawPlot();
}

View File

@ -52,42 +52,42 @@ TestWidgetRGBImages::TestWidgetRGBImages(QWidget *parent) :
}
}
rgbimg=new JKQTPRGBMathImage(0,0,10,10, JKQTPMathImageBase::DoubleArray, rgb_rimg2, 100, 100, plotImgRGB->getPlotter());
rgbimg->set_imageMin(-1);
rgbimg->set_imageMax(0.5);
rgbimg->set_imageMinB(-1);
rgbimg->set_imageMaxB(0.5);
rgbimg->set_imageName("R image");
rgbimg->set_imageNameG("G image");
rgbimg->set_imageNameB("B image");
rgbimg->set_data(rgb_rimg2, rgb_gimg2, rgb_bimg2, 100, 100, JKQTPMathImageBase::DoubleArray);
rgbimg->set_dataModifier(rgb_aimg2, JKQTPMathImageBase::DoubleArray);
rgbimg->set_modifierMode(JKQTPMathImageBase::ModifyNone);
rgbimg->setImageMin(-1);
rgbimg->setImageMax(0.5);
rgbimg->setImageMinB(-1);
rgbimg->setImageMaxB(0.5);
rgbimg->setImageName("R image");
rgbimg->setImageNameG("G image");
rgbimg->setImageNameB("B image");
rgbimg->setData(rgb_rimg2, rgb_gimg2, rgb_bimg2, 100, 100, JKQTPMathImageBase::DoubleArray);
rgbimg->setDataModifier(rgb_aimg2, JKQTPMathImageBase::DoubleArray);
rgbimg->setModifierMode(JKQTPMathImageBase::ModifyNone);
plotImgRGB->getPlotter()->addGraph(rgbimg);
rgbimg->set_autoImageRange(false);
rgbimg->set_colorBarTopVisible(true);
rgbimg->set_colorBarRightVisible(true);
rgbimg->set_colorbarsSideBySide(chkColorbars->isChecked());
rgbimg->setAutoImageRange(false);
rgbimg->setColorBarTopVisible(true);
rgbimg->setColorBarRightVisible(true);
rgbimg->setColorbarsSideBySide(chkColorbars->isChecked());
rgbimg2=new JKQTPColumnRGBMathImage(10,0,10,10,100,100, plotImgRGB->getPlotter());
rgbimg2->set_imageMin(-1);
rgbimg2->set_imageMax(0.5);
rgbimg2->set_imageMinB(-1);
rgbimg2->set_imageMaxB(0.5);
rgbimg2->set_imageName("R image");
rgbimg2->set_imageNameG("G image");
rgbimg2->set_imageNameB("B image");
rgbimg2->set_Nx(100);
rgbimg2->set_Ny(100);
rgbimg2->set_imageRColumn(rgb_colr=plotImgRGB->getDatastore()->addCopiedColumn(rgb_bimg2, 100*100, "R"));
rgbimg2->set_imageGColumn(rgb_colg=plotImgRGB->getDatastore()->addCopiedColumn(rgb_gimg2, 100*100, "G"));
rgbimg2->set_imageBColumn(rgb_colb=plotImgRGB->getDatastore()->addCopiedColumn(rgb_rimg2, 100*100, "B"));
rgbimg2->set_modifierColumn(rgb_cola=plotImgRGB->getDatastore()->addCopiedColumn(rgb_aimg2, 100*100, "alpha"));
rgbimg2->set_modifierMode(JKQTPMathImageBase::ModifyNone);
//rgbimg2->set_data(rgb_rimg2, rgb_gimg2, rgb_bimg2, 100, 100, JKQTPMathImageBase::DoubleArray);
rgbimg2->setImageMin(-1);
rgbimg2->setImageMax(0.5);
rgbimg2->setImageMinB(-1);
rgbimg2->setImageMaxB(0.5);
rgbimg2->setImageName("R image");
rgbimg2->setImageNameG("G image");
rgbimg2->setImageNameB("B image");
rgbimg2->setNx(100);
rgbimg2->setNy(100);
rgbimg2->setImageRColumn(rgb_colr=plotImgRGB->getDatastore()->addCopiedColumn(rgb_bimg2, 100*100, "R"));
rgbimg2->setImageGColumn(rgb_colg=plotImgRGB->getDatastore()->addCopiedColumn(rgb_gimg2, 100*100, "G"));
rgbimg2->setImageBColumn(rgb_colb=plotImgRGB->getDatastore()->addCopiedColumn(rgb_rimg2, 100*100, "B"));
rgbimg2->setModifierColumn(rgb_cola=plotImgRGB->getDatastore()->addCopiedColumn(rgb_aimg2, 100*100, "alpha"));
rgbimg2->setModifierMode(JKQTPMathImageBase::ModifyNone);
//rgbimg2->setData(rgb_rimg2, rgb_gimg2, rgb_bimg2, 100, 100, JKQTPMathImageBase::DoubleArray);
plotImgRGB->getPlotter()->addGraph(rgbimg2);
rgbimg2->set_autoImageRange(true);
rgbimg2->set_colorBarTopVisible(true);
rgbimg2->set_colorBarRightVisible(true);
rgbimg2->set_colorbarsSideBySide(chkColorbars->isChecked());
rgbimg2->setAutoImageRange(true);
rgbimg2->setColorBarTopVisible(true);
rgbimg2->setColorBarRightVisible(true);
rgbimg2->setColorbarsSideBySide(chkColorbars->isChecked());
plotImgRGB->setAbsoluteXY(0,20,0,10);
plotImgRGB->setPlotUpdateEnabled(true);
//plotImgRGB->zoomToFit();
@ -151,53 +151,53 @@ TestWidgetRGBImages::TestWidgetRGBImages(QWidget *parent) :
void TestWidgetRGBImages::setRGBColorBars(bool checked)
{
rgbimg->set_colorbarsSideBySide(checked);
rgbimg2->set_colorbarsSideBySide(checked);
rgbimg->setColorbarsSideBySide(checked);
rgbimg2->setColorbarsSideBySide(checked);
plotImgRGB->redrawPlot();
}
void TestWidgetRGBImages::setRGBMode1(int mode)
{
rgbimg->set_rgbMode((JKQTPRGBMathImageRGBMode)mode);
rgbimg->setRgbMode((JKQTPRGBMathImageRGBMode)mode);
plotImgRGB->redrawPlot();
}
void TestWidgetRGBImages::setRGBMode2(int mode)
{
rgbimg2->set_rgbMode((JKQTPRGBMathImageRGBMode)mode);
rgbimg2->setRgbMode((JKQTPRGBMathImageRGBMode)mode);
plotImgRGB->redrawPlot();
}
void TestWidgetRGBImages::updateRGBChannels()
{
if (chkRGBUseR->isChecked()) {
rgbimg->set_data(rgb_rimg2, 100, 100);
rgbimg2->set_imageRColumn(rgb_colr);
rgbimg->setData(rgb_rimg2, 100, 100);
rgbimg2->setImageRColumn(rgb_colr);
} else {
rgbimg->set_data(nullptr, 100, 100);
rgbimg2->set_imageRColumn(-1);
rgbimg->setData(nullptr, 100, 100);
rgbimg2->setImageRColumn(-1);
}
if (chkRGBUseG->isChecked()) {
rgbimg->set_dataG(rgb_gimg2);
rgbimg2->set_imageGColumn(rgb_colg);
rgbimg->setDataG(rgb_gimg2);
rgbimg2->setImageGColumn(rgb_colg);
} else {
rgbimg->set_dataG(nullptr);
rgbimg2->set_imageGColumn(-1);
rgbimg->setDataG(nullptr);
rgbimg2->setImageGColumn(-1);
}
if (chkRGBUseB->isChecked()) {
rgbimg->set_dataB(rgb_bimg2);
rgbimg2->set_imageBColumn(rgb_colb);
rgbimg->setDataB(rgb_bimg2);
rgbimg2->setImageBColumn(rgb_colb);
} else {
rgbimg->set_dataB(nullptr);
rgbimg2->set_imageBColumn(-1);
rgbimg->setDataB(nullptr);
rgbimg2->setImageBColumn(-1);
}
plotImgRGB->redrawPlot();
}
void TestWidgetRGBImages::setRGBModifier(int item)
{
rgbimg->set_modifierMode(JKQTPMathImage::ModifierMode(item));
rgbimg2->set_modifierMode(JKQTPMathImage::ModifierMode(item));
rgbimg->setModifierMode(JKQTPMathImage::ModifierMode(item));
rgbimg2->setModifierMode(JKQTPMathImage::ModifierMode(item));
plotImgRGB->redrawPlot();
}

View File

@ -53,7 +53,7 @@ win32-msvc*: DEFINES += _USE_MATH_DEFINES
TARGET = jkqtplot_test
# configure Qt
CONFIG += qt
CONFIG += link_prl qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

View File

@ -75,9 +75,9 @@ int main(int argc, char* argv[])
// 4. create a graph in the plot, which plots the dataset X/Y:
JKQTPXYLineGraph* graph1=new JKQTPXYLineGraph(&plot);
graph1->set_xColumn(columnX);
graph1->set_yColumn(columnY);
graph1->set_title(QObject::tr("sine graph"));
graph1->setXColumn(columnX);
graph1->setYColumn(columnY);
graph1->setTitle(QObject::tr("sine graph"));
// 5. add the graph to the plot, so it is actually displayed
plot.addGraph(graph1);

View File

@ -36,9 +36,9 @@ int main(int argc, char* argv[])
// 4. create a graph in the plot, which plots the dataset X/Y:
JKQTPXYLineGraph* graph1=new JKQTPXYLineGraph(&plot);
graph1->set_xColumn(columnX);
graph1->set_yColumn(columnY);
graph1->set_title(QObject::tr("sine graph"));
graph1->setXColumn(columnX);
graph1->setYColumn(columnY);
graph1->setTitle(QObject::tr("sine graph"));
// 5. add the graph to the plot, so it is actually displayed
plot.addGraph(graph1);

View File

@ -2,7 +2,7 @@
SOURCES = jkqtplotter_simpletest.cpp
# configure Qt
CONFIG += qt
CONFIG += link_prl qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

View File

@ -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:
JKQTPBarVerticalGraph* graph1=new JKQTPBarVerticalGraph(&plot);
graph1->set_xColumn(columnX);
graph1->set_yColumn(columnY1);
graph1->set_title(QObject::tr("dataset 1"));
graph1->setXColumn(columnX);
graph1->setYColumn(columnY1);
graph1->setTitle(QObject::tr("dataset 1"));
JKQTPBarVerticalGraph* graph2=new JKQTPBarVerticalGraph(&plot);
graph2->set_xColumn(columnX);
graph2->set_yColumn(columnY2);
graph2->set_title(QObject::tr("dataset 2"));
graph2->setXColumn(columnX);
graph2->setYColumn(columnY2);
graph2->setTitle(QObject::tr("dataset 2"));
JKQTPBarVerticalGraph* graph3=new JKQTPBarVerticalGraph(&plot);
graph3->set_xColumn(columnX);
graph3->set_yColumn(columnY3);
graph3->set_title(QObject::tr("dataset 3"));
graph3->setXColumn(columnX);
graph3->setYColumn(columnY3);
graph3->setTitle(QObject::tr("dataset 3"));
// 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:
plot.getXAxis()->addAxisTickLabels(X, L, Ndata);
// also we can rotate the labels a bit (by 45 degree), so they fit better
plot.getXAxis()->set_tickLabelAngle(45);
plot.getXAxis()->set_tickLabelFontSize(12);
plot.getXAxis()->setTickLabelAngle(45);
plot.getXAxis()->setTickLabelFontSize(12);
// 8. finally we move the plot key/legend to the outside, top-right
// and lay it out as a single row

View File

@ -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:
JKQTPBarVerticalGraph* graph1=new JKQTPBarVerticalGraph(&plot);
graph1->set_xColumn(columnX);
graph1->set_yColumn(columnY1);
graph1->set_title(QObject::tr("dataset 1"));
graph1->setXColumn(columnX);
graph1->setYColumn(columnY1);
graph1->setTitle(QObject::tr("dataset 1"));
JKQTPBarVerticalGraph* graph2=new JKQTPBarVerticalGraph(&plot);
graph2->set_xColumn(columnX);
graph2->set_yColumn(columnY2);
graph2->set_title(QObject::tr("dataset 2"));
graph2->setXColumn(columnX);
graph2->setYColumn(columnY2);
graph2->setTitle(QObject::tr("dataset 2"));
JKQTPBarVerticalGraph* graph3=new JKQTPBarVerticalGraph(&plot);
graph3->set_xColumn(columnX);
graph3->set_yColumn(columnY3);
graph3->set_title(QObject::tr("dataset 3"));
graph3->setXColumn(columnX);
graph3->setYColumn(columnY3);
graph3->setTitle(QObject::tr("dataset 3"));
// 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:
plot.getXAxis()->addAxisTickLabels(X, L, Ndata);
// also we can rotate the labels a bit (by 45 degree), so they fit better
plot.getXAxis()->set_tickLabelAngle(45);
plot.getXAxis()->set_tickLabelFontSize(12);
plot.getXAxis()->setTickLabelAngle(45);
plot.getXAxis()->setTickLabelFontSize(12);
// 8. finally we move the plot key/legend to the outside, top-right
// and lay it out as a single row

View File

@ -2,7 +2,7 @@
SOURCES = jkqtplotter_simpletest_barchart.cpp
# configure Qt
CONFIG += qt
CONFIG += link_prl qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

View File

@ -32,25 +32,25 @@ After adding all necessary data to the JKQTDatastore:
```.cpp
// 4. create a graph of vertical boxplots:
JKQTPBoxplotVerticalGraph* graph=new JKQTPBoxplotVerticalGraph(&plot);
graph->set_posColumn(columnPOS);
graph->set_minColumn(columnMIN);
graph->set_percentile25Column(columnQ25);
graph->set_medianColumn(columnMEDIAN);
graph->set_meanColumn(columnMEAN);
graph->set_percentile75Column(columnQ75);
graph->set_maxColumn(columnMAX);
graph->set_title("vertical Boxplots");
graph->setPosColumn(columnPOS);
graph->setMinColumn(columnMIN);
graph->setPercentile25Column(columnQ25);
graph->setMedianColumn(columnMEDIAN);
graph->setMeanColumn(columnMEAN);
graph->setPercentile75Column(columnQ75);
graph->setMaxColumn(columnMAX);
graph->setTitle("vertical Boxplots");
```
You can further style the plot by e.g. setting:
```.cpp
// 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
graph->set_whiskerStyle(Qt::DashLine);
graph->setWhiskerStyle(Qt::DashLine);
// 4.3 change mean symbol
graph->set_meanSymbol(JKQTPstar);
graph->setMeanSymbol(JKQTPstar);
```
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
JKQTPXYLineGraph* graphOutliers=new JKQTPXYLineGraph(&plot);
graphOutliers->set_xColumn(columnOUTLIERSX);
graphOutliers->set_yColumn(columnOUTLIERSY);
graphOutliers->set_title("outliers");
graphOutliers->setXColumn(columnOUTLIERSX);
graphOutliers->setYColumn(columnOUTLIERSY);
graphOutliers->setTitle("outliers");
// make the color a darker shade of the color of graph
graphOutliers->set_color(graph->get_color().darker());
graphOutliers->set_fillColor(QColor("white"));
graphOutliers->setColor(graph->getColor().darker());
graphOutliers->setFillColor(QColor("white"));
// draw outliers as small circles, without lines
graphOutliers->set_symbol(JKQTPCircle);
graphOutliers->set_drawLine(false);
graphOutliers->set_symbolSize(7);
graphOutliers->setSymbol(JKQTPCircle);
graphOutliers->setDrawLine(false);
graphOutliers->setSymbolSize(7);
```

View File

@ -48,44 +48,44 @@ int main(int argc, char* argv[])
// 4. create a graph of vertical boxplots:
JKQTPBoxplotVerticalGraph* graph=new JKQTPBoxplotVerticalGraph(&plot);
graph->set_posColumn(columnPOS);
graph->set_minColumn(columnMIN);
graph->set_percentile25Column(columnQ25);
graph->set_medianColumn(columnMEDIAN);
graph->set_meanColumn(columnMEAN);
graph->set_percentile75Column(columnQ75);
graph->set_maxColumn(columnMAX);
graph->set_title("vertical Boxplots");
graph->setPosColumn(columnPOS);
graph->setMinColumn(columnMIN);
graph->setPercentile25Column(columnQ25);
graph->setMedianColumn(columnMEDIAN);
graph->setMeanColumn(columnMEAN);
graph->setPercentile75Column(columnQ75);
graph->setMaxColumn(columnMAX);
graph->setTitle("vertical Boxplots");
// 5. outliers need to be drawn separately
JKQTPXYLineGraph* graphOutliers=new JKQTPXYLineGraph(&plot);
graphOutliers->set_xColumn(columnOUTLIERSX);
graphOutliers->set_yColumn(columnOUTLIERSY);
graphOutliers->set_title("outliers");
graphOutliers->setXColumn(columnOUTLIERSX);
graphOutliers->setYColumn(columnOUTLIERSY);
graphOutliers->setTitle("outliers");
// make the color a darker shade of the color of graph
graphOutliers->set_color(graph->get_color().darker());
graphOutliers->set_fillColor(QColor("white"));
graphOutliers->setColor(graph->getColor().darker());
graphOutliers->setFillColor(QColor("white"));
// draw outliers as small circles, without lines
graphOutliers->set_symbol(JKQTPCircle);
graphOutliers->set_drawLine(false);
graphOutliers->set_symbolSize(7);
graphOutliers->setSymbol(JKQTPCircle);
graphOutliers->setDrawLine(false);
graphOutliers->setSymbolSize(7);
// 6. create a graph of horizontal boxplots:
JKQTPBoxplotHorizontalGraph* graphh=new JKQTPBoxplotHorizontalGraph(&plot);
graphh->set_posColumn(columnPOSY);
graphh->set_minColumn(columnMIN);
graphh->set_percentile25Column(columnQ25);
graphh->set_medianColumn(columnMEDIAN);
graphh->set_meanColumn(columnMEAN);
graphh->set_percentile75Column(columnQ75);
graphh->set_maxColumn(columnMAX);
graphh->set_title("horizontal Boxplots");
graphh->setPosColumn(columnPOSY);
graphh->setMinColumn(columnMIN);
graphh->setPercentile25Column(columnQ25);
graphh->setMedianColumn(columnMEDIAN);
graphh->setMeanColumn(columnMEAN);
graphh->setPercentile75Column(columnQ75);
graphh->setMaxColumn(columnMAX);
graphh->setTitle("horizontal Boxplots");
// 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
graphh->set_whiskerStyle(Qt::DashLine);
graphh->setWhiskerStyle(Qt::DashLine);
// 6.3 change mean symbol
graphh->set_meanSymbol(JKQTPstar);
graphh->setMeanSymbol(JKQTPstar);
// 7. add the graphs to the plot, so it is actually displayed

View File

@ -2,7 +2,7 @@
SOURCES = jkqtplotter_simpletest_boxplot.cpp
# configure Qt
CONFIG += qt
CONFIG += link_prl qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

View File

@ -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
size_t colDate=ds->addCopiedColumn(date, "date");
graphTemperatureRange->set_xColumn(colDate);
graphTemperatureRange->set_yColumn(ds->addCopiedColumn(temperature_min, "temperature_min"));
graphTemperatureRange->set_yColumn2(ds->addCopiedColumn(temperature_max, "temperature_max"));
graphTemperatureRange->setXColumn(colDate);
graphTemperatureRange->setYColumn(ds->addCopiedColumn(temperature_min, "temperature_min"));
graphTemperatureRange->setYColumn2(ds->addCopiedColumn(temperature_max, "temperature_max"));
// 5. min/max range data
// 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
graphTemperatureRange->set_drawLine(false);
graphTemperatureRange->setDrawLine(false);
// 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
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
size_t colDate=ds->addCopiedColumn(date, "date");
graphTemperature->set_xColumn(colDate);
graphTemperature->set_yColumn(ds->addCopiedColumn(temperature, "temperature"));
graphTemperature->setXColumn(colDate);
graphTemperature->setYColumn(ds->addCopiedColumn(temperature, "temperature"));
// 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
// don't use symbols
graphTemperature->set_symbol(JKQTPNoSymbol);
graphTemperature->setSymbol(JKQTPNoSymbol);
// set the line width
graphTemperature->setLineWidth(1);
// draw small symbols
graphTemperature->set_symbolSize(6);
graphTemperature->setSymbolSize(6);
// graph title
graphTemperature->set_title("Average Temperature");
graphTemperature->setTitle("Average Temperature");
// add the graph to the plot, so it is actually displayed
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
plot.getPlotter()->setPlotLabel("\\textbf{Weather in Gelsenkirchen, 2017-2018}");
// set x-axis date-time-axis
plot.getXAxis()->set_labelType(JKQTPCALTdatetime);
plot.getXAxis()->setLabelType(JKQTPCALTdatetime);
plot.getXAxis()->setAxisLabel("Date");
// 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
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
plot.getPlotter()->setPlotLabel("\\textbf{Weather in Heidelberg, 14^{th} Oct 2018}");
// set x-axis date-time-axis
plot.getXAxis()->set_labelType(JKQTPCALTtime);
plot.getXAxis()->setLabelType(JKQTPCALTtime);
plot.getXAxis()->setAxisLabel("Time of Day");
// set format string for time axis with 24-hour and minute only,
// 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
plot.getYAxis()->setAxisLabel("Temperature [{\\degree}C]");
```

View File

@ -48,32 +48,32 @@ void drawWithDateAxis(JKQTPlotter& plot) {
// 4. copy data into datastore and immediately set the yColumn
size_t colDate=ds->addCopiedColumn(date, "date");
graphTemperature->set_xColumn(colDate);
graphTemperature->set_yColumn(ds->addCopiedColumn(temperature, "temperature"));
graphTemperatureRange->set_xColumn(colDate);
graphTemperatureRange->set_yColumn(ds->addCopiedColumn(temperature_min, "temperature_min"));
graphTemperatureRange->set_yColumn2(ds->addCopiedColumn(temperature_max, "temperature_max"));
graphTemperature->setXColumn(colDate);
graphTemperature->setYColumn(ds->addCopiedColumn(temperature, "temperature"));
graphTemperatureRange->setXColumn(colDate);
graphTemperatureRange->setYColumn(ds->addCopiedColumn(temperature_min, "temperature_min"));
graphTemperatureRange->setYColumn2(ds->addCopiedColumn(temperature_max, "temperature_max"));
// 5. min/max range data
// 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
graphTemperatureRange->set_drawLine(false);
graphTemperatureRange->setDrawLine(false);
// 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
plot.addGraph(graphTemperatureRange);
// 6. average data
// don't use symbols
graphTemperature->set_symbol(JKQTPNoSymbol);
graphTemperature->setSymbol(JKQTPNoSymbol);
// set the line width
graphTemperature->setLineWidth(1);
// draw small symbols
graphTemperature->set_symbolSize(6);
graphTemperature->setSymbolSize(6);
// graph title
graphTemperature->set_title("Average Temperature");
graphTemperature->setTitle("Average Temperature");
// add the graph to the plot, so it is actually displayed
plot.addGraph(graphTemperature);
@ -82,10 +82,10 @@ void drawWithDateAxis(JKQTPlotter& plot) {
// set the title above the plot, use LaTeX instructions to make text bold
plot.getPlotter()->setPlotLabel("\\textbf{Weather in Gelsenkirchen, 2017-2018}");
// set x-axis date-time-axis
plot.getXAxis()->set_labelType(JKQTPCALTdatetime);
plot.getXAxis()->setLabelType(JKQTPCALTdatetime);
plot.getXAxis()->setAxisLabel("Date");
// 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
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
size_t colDate=ds->addCopiedColumn(time, "time");
graphTemperature->set_xColumn(colDate);
graphTemperature->set_yColumn(ds->addCopiedColumn(temperature, "temperature"));
graphTemperature->setXColumn(colDate);
graphTemperature->setYColumn(ds->addCopiedColumn(temperature, "temperature"));
// 6. average data
// don't use symbols
graphTemperature->set_symbol(JKQTPCross);
graphTemperature->setSymbol(JKQTPCross);
// set the line width
graphTemperature->setLineWidth(1);
// draw small symbols
graphTemperature->set_symbolSize(6);
graphTemperature->setSymbolSize(6);
// graph title
graphTemperature->set_title("Average Temperature");
graphTemperature->setTitle("Average Temperature");
// add the graph to the plot, so it is actually displayed
plot.addGraph(graphTemperature);
@ -149,11 +149,11 @@ void drawWithTimeAxis(JKQTPlotter& plot) {
// set the title above the plot, use LaTeX instructions to make text bold
plot.getPlotter()->setPlotLabel("\\textbf{Weather in Heidelberg, 14^{th} Oct 2018}");
// set x-axis date-time-axis
plot.getXAxis()->set_labelType(JKQTPCALTtime);
plot.getXAxis()->setLabelType(JKQTPCALTtime);
plot.getXAxis()->setAxisLabel("Time of Day");
// set format string for time axis with 24-hour and minute only,
// 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
plot.getYAxis()->setAxisLabel("Temperature [{\\degree}C]");

View File

@ -2,7 +2,7 @@
SOURCES = jkqtplotter_simpletest_dateaxes.cpp
# configure Qt
CONFIG += qt
CONFIG += link_prl qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

View File

@ -25,44 +25,44 @@ First some data is added to the internal datastore (mostly, like explained in se
JKQTPXYLineErrorGraph* graph=new JKQTPXYLineErrorGraph(&plot);
// copy data into datastore and immediately set the yColumn
graph->set_xColumn(columnX);
graph->set_yColumn(ds->addCopiedColumn(Y, "y"+QString::number(errorID)));
graph->set_xErrorColumn(columnXError);
graph->set_yErrorColumn(columnYError);
graph->setXColumn(columnX);
graph->setYColumn(ds->addCopiedColumn(Y, "y"+QString::number(errorID)));
graph->setXErrorColumn(columnXError);
graph->setYErrorColumn(columnYError);
// set error style, for the y-axis
graph->set_yErrorStyle(errorStyles[errorID]);
graph->setYErrorStyle(errorStyles[errorID]);
// 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
if (showXandYError[errorID]) {
graph->set_xErrorStyle(errorStyles[errorID]);
graph->set_drawLine(false);
graph->setXErrorStyle(errorStyles[errorID]);
graph->setDrawLine(false);
}
// make error indicator 30% transparent
QColor c=graph->get_errorFillColor();
QColor c=graph->getErrorFillColor();
c.setAlphaF(0.3);
graph->set_errorFillColor(c);
graph->setErrorFillColor(c);
// set error indicator line width
graph->set_errorWidth(1);
graph->setErrorWidth(1);
// 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)
graph->set_symbol(JKQTPCross);
graph->set_style(Qt::DashLine);
graph->setSymbol(JKQTPCross);
graph->setStyle(Qt::DashLine);
// set symbol size
graph->set_symbolSize(5);
graph->setSymbolSize(5);
// set width of symbol lines
graph->set_symbolWidth(1);
graph->setSymbolWidth(1);
// set width of graph line
graph->setLineWidth(1);
// 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
// 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
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:
```.cpp
// set error style, for the y-axis
graph->set_yErrorStyle(errorStyles[errorID]);
graph->setYErrorStyle(errorStyles[errorID]);
// 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:
```.cpp
// make error indicator 30% transparent
QColor c=graph->get_errorFillColor();
QColor c=graph->getErrorFillColor();
c.setAlphaF(0.3);
graph->set_errorFillColor(c);
graph->setErrorFillColor(c);
// set error indicator line width
graph->set_errorWidth(1);
graph->setErrorWidth(1);
// 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`.
@ -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)
plot.getPlotter()->setKeyPosition(JKQTPKeyOutsideRightTop);
// ... and switch off the grid
plot.getXAxis()->set_drawGrid(false);
plot.getXAxis()->set_drawMinorGrid(false);
plot.getYAxis()->set_drawGrid(false);
plot.getYAxis()->set_drawMinorGrid(false);
plot.getXAxis()->setDrawGrid(false);
plot.getXAxis()->setDrawMinorGrid(false);
plot.getYAxis()->setDrawGrid(false);
plot.getYAxis()->setDrawMinorGrid(false);
```
The result looks like this:

View File

@ -54,44 +54,44 @@ int main(int argc, char* argv[])
JKQTPXYLineErrorGraph* graph=new JKQTPXYLineErrorGraph(&plot);
// copy data into datastore and immediately set the yColumn
graph->set_xColumn(columnX);
graph->set_yColumn(ds->addCopiedColumn(Y, "y"+QString::number(errorID)));
graph->set_xErrorColumn(columnXError);
graph->set_yErrorColumn(columnYError);
graph->setXColumn(columnX);
graph->setYColumn(ds->addCopiedColumn(Y, "y"+QString::number(errorID)));
graph->setXErrorColumn(columnXError);
graph->setYErrorColumn(columnYError);
// set error style, for the y-axis
graph->set_yErrorStyle(errorStyles[errorID]);
graph->setYErrorStyle(errorStyles[errorID]);
// 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
if (showXandYError[errorID]) {
graph->set_xErrorStyle(errorStyles[errorID]);
graph->set_drawLine(false);
graph->setXErrorStyle(errorStyles[errorID]);
graph->setDrawLine(false);
}
// make error indicator 30% transparent
QColor c=graph->get_errorFillColor();
QColor c=graph->getErrorFillColor();
c.setAlphaF(0.3);
graph->set_errorFillColor(c);
graph->setErrorFillColor(c);
// set error indicator line width
graph->set_errorWidth(1);
graph->setErrorWidth(1);
// 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)
graph->set_symbol(JKQTPCross);
graph->set_style(Qt::DashLine);
graph->setSymbol(JKQTPCross);
graph->setStyle(Qt::DashLine);
// set symbol size
graph->set_symbolSize(5);
graph->setSymbolSize(5);
// set width of symbol lines
graph->set_symbolWidth(1);
graph->setSymbolWidth(1);
// set width of graph line
graph->setLineWidth(1);
// 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
// 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
plot.addGraph(graph);
@ -103,10 +103,10 @@ int main(int argc, char* argv[])
// 6. change locaion of key (outside top-right)
plot.getPlotter()->setKeyPosition(JKQTPKeyOutsideRightTop);
// ... and switch off the grid
plot.getXAxis()->set_drawGrid(false);
plot.getXAxis()->set_drawMinorGrid(false);
plot.getYAxis()->set_drawGrid(false);
plot.getYAxis()->set_drawMinorGrid(false);
plot.getXAxis()->setDrawGrid(false);
plot.getXAxis()->setDrawMinorGrid(false);
plot.getYAxis()->setDrawGrid(false);
plot.getYAxis()->setDrawMinorGrid(false);
// 7. show plotter and make it a decent size
plot.show();

View File

@ -2,7 +2,7 @@
SOURCES = jkqtplotter_simpletest_errorbarstyles.cpp
# configure Qt
CONFIG += qt
CONFIG += link_prl qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

View File

@ -54,15 +54,15 @@ Finally three `JKQTPFilledCurveXGraph` objects are generated and added to the pl
JKQTPFilledCurveXGraph* graphR=new JKQTPFilledCurveXGraph(&plot);
// set graph titles
graphR->set_title("R-channel");
graphR->setTitle("R-channel");
// set graph colors (lines: non-transparent, fill: semi-transparent
QColor col;
col=QColor("red"); graphR->set_color(col);
col.setAlphaF(0.25); graphR->set_fillColor(col);
col=QColor("red"); graphR->setColor(col);
col.setAlphaF(0.25); graphR->setFillColor(col);
// 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

View File

@ -58,26 +58,26 @@ int main(int argc, char* argv[])
JKQTPFilledCurveXGraph* graphB=new JKQTPFilledCurveXGraph(&plot);
// set graph titles
graphR->set_title("R-channel");
graphG->set_title("G-channel");
graphB->set_title("B-channel");
graphR->setTitle("R-channel");
graphG->setTitle("G-channel");
graphB->setTitle("B-channel");
// set graph colors (lines: non-transparent, fill: semi-transparent) and style
QColor col;
col=QColor("red"); graphR->set_color(col);
col.setAlphaF(0.25); graphR->set_fillColor(col);
col=QColor("green"); graphG->set_color(col);
col.setAlphaF(0.25); graphG->set_fillColor(col);
col=QColor("blue"); graphB->set_color(col);
col.setAlphaF(0.25); graphB->set_fillColor(col);
col=QColor("red"); graphR->setColor(col);
col.setAlphaF(0.25); graphR->setFillColor(col);
col=QColor("green"); graphG->setColor(col);
col.setAlphaF(0.25); graphG->setFillColor(col);
col=QColor("blue"); graphB->setColor(col);
col.setAlphaF(0.25); graphB->setFillColor(col);
graphR->setLineWidth(1);
graphG->setLineWidth(1);
graphB->setLineWidth(1);
// set data
graphR->set_xColumn(columnX); graphR->set_yColumn(columnR);
graphG->set_xColumn(columnX); graphG->set_yColumn(columnG);
graphB->set_xColumn(columnX); graphB->set_yColumn(columnB);
graphR->setXColumn(columnX); graphR->setYColumn(columnR);
graphG->setXColumn(columnX); graphG->setYColumn(columnG);
graphB->setXColumn(columnX); graphB->setYColumn(columnB);
// add the graphs to the plot, so they are actually displayed

View File

@ -4,7 +4,7 @@ SOURCES = jkqtplotter_simpletest_filledgraphs.cpp
RESOURCES += jkqtplotter_simpletest_filledgraphs.qrc
# configure Qt
CONFIG += qt
CONFIG += link_prl qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

View File

@ -7,12 +7,12 @@ The first example shows how to plot a C++ inline function:
```.cpp
JKQTPXFunctionLineGraph* func1=new JKQTPXFunctionLineGraph(plot);
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);
```
## 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
JKQTPXFunctionLineGraph* func2=new JKQTPXFunctionLineGraph(plot);
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));
});
// here we set the parameters p0, p1
func2->set_paramsV(5, 0.2);
func2->set_title("C++-inline function with int. params $p_0\\cdot\\sin(x*2.0*\\pi\\cdot p_1)$");
func2->setParamsV(5, 0.2);
func2->setTitle("C++-inline function with int. params $p_0\\cdot\\sin(x*2.0*\\pi\\cdot p_1)$");
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
JKQTPXFunctionLineGraph* func3=new JKQTPXFunctionLineGraph(plot);
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;
params3["amplitude"]=-3;
params3["frequency"]=0.3;
func3->set_params(&params3);
func3->set_title("C++-inline function with ext. params $p_0\\cdot\\sin(x*2.0*\\pi\\cdot p_1)$");
func3->setParams(&params3);
func3->setTitle("C++-inline function with ext. params $p_0\\cdot\\sin(x*2.0*\\pi\\cdot p_1)$");
plot->addGraph(func3);
```
@ -58,7 +58,7 @@ You can also use C++ functors (or function objects):
JKQTPXFunctionLineGraph* func4=new JKQTPXFunctionLineGraph(plot);
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);
```
@ -73,7 +73,7 @@ You can also plot simple static C functions:
JKQTPXFunctionLineGraph* func5=new JKQTPXFunctionLineGraph(plot);
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);
```
@ -83,8 +83,8 @@ Finally `JKQTPXFunctionLineGraph` provides a small set of special functions (pol
JKQTPXFunctionLineGraph* func6=new JKQTPXFunctionLineGraph(plot);
func6->setSpecialFunction(JKQTPXFunctionLineGraph::Line);
// here we set offset p0=-1 and slope p1=1.5 of the line p0+p1*x
func6->set_paramsV(-1,1.5);
func6->set_title("special function: linear");
func6->setParamsV(-1,1.5);
func6->setTitle("special function: linear");
plot->addGraph(func6);
```
@ -97,8 +97,8 @@ JKQTPXFunctionLineGraph* func7=new JKQTPXFunctionLineGraph(plot);
QVector<double> params;
params << /*p0=*/1 << /*p1=*/-1.5;
size_t paramCol=plot->getDatastore()->addCopiedColumn(params);
func7->set_parameterColumn(paramCol);
func7->set_title("special function: linear");
func7->setParameterColumn(paramCol);
func7->setTitle("special function: linear");
plot->addGraph(func7);
```

View File

@ -40,7 +40,7 @@ int main(int argc, char* argv[])
// the function is defined as C++ inline function
JKQTPXFunctionLineGraph* func1=new JKQTPXFunctionLineGraph(plot);
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);
// 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));
});
// here we set the parameters p0, p1
func2->set_paramsV(5, 0.2);
func2->set_title("C++-inline function with int. params $p_0\\cdot\\sin(x*2.0*\\pi\\cdot p_1)$");
func2->setParamsV(5, 0.2);
func2->setTitle("C++-inline function with int. params $p_0\\cdot\\sin(x*2.0*\\pi\\cdot p_1)$");
plot->addGraph(func2);
// 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;
params3["amplitude"]=-3;
params3["frequency"]=0.3;
func3->set_params(&params3);
func3->set_title("C++-inline function with ext. params $p_0\\cdot\\sin(x*2.0*\\pi\\cdot p_1)$");
func3->setParams(&params3);
func3->setTitle("C++-inline function with ext. params $p_0\\cdot\\sin(x*2.0*\\pi\\cdot p_1)$");
plot->addGraph(func3);
// 5. of course the function may also be any C+ funtor object:
JKQTPXFunctionLineGraph* func4=new JKQTPXFunctionLineGraph(plot);
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);
// 6. now we use a JKQTPXFunctionLineGraph to draw a static C function
JKQTPXFunctionLineGraph* func5=new JKQTPXFunctionLineGraph(plot);
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);
// 7. finally JKQTPXFunctionLineGraph defines a small set of common functions
JKQTPXFunctionLineGraph* func6=new JKQTPXFunctionLineGraph(plot);
func6->setSpecialFunction(JKQTPXFunctionLineGraph::Line);
// here we set offset p0=-1 and slope p1=1.5 of the line p0+p1*x
func6->set_paramsV(-1,1.5);
func6->set_title("special function: linear p_0=-1, p_1=1.5");
func6->setParamsV(-1,1.5);
func6->setTitle("special function: linear p_0=-1, p_1=1.5");
plot->addGraph(func6);
// 7. finally JKQTPXFunctionLineGraph defines a small set of common functions
@ -101,8 +101,8 @@ int main(int argc, char* argv[])
QVector<double> params;
params << /*p0=*/1 << /*p1=*/-1.5;
size_t paramCol=plot->getDatastore()->addCopiedColumn(params);
func7->set_parameterColumn(paramCol);
func7->set_title("special function: linear p_0=1, p_1=-1.5");
func7->setParameterColumn(paramCol);
func7->setTitle("special function: linear p_0=1, p_1=-1.5");
plot->addGraph(func7);

View File

@ -2,7 +2,7 @@
SOURCES = jkqtplotter_simpletest_functionplot.cpp
# configure Qt
CONFIG += qt
CONFIG += link_prl qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

View File

@ -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
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);
plot.addGraph(infLine);

View File

@ -25,8 +25,8 @@ int main(int argc, char* argv[])
plot.getPlotter()->setMaintainAxisAspectRatio(true);
plot.getPlotter()->setAxisAspectRatio(1);
// 2.3 set the asxpect ratio to 1
plot.getXAxis()->set_drawGrid(false);
plot.getYAxis()->set_drawGrid(false);
plot.getXAxis()->setDrawGrid(false);
plot.getYAxis()->setDrawGrid(false);
// 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);
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);
infLine->set_two_sided(false);
infLine->setTwoSided(false);
infLine->setAlpha(0.5);
plot.addGraph(infLine);
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);
plot.addGraph(infLine);

View File

@ -2,7 +2,7 @@
SOURCES = jkqtplotter_simpletest_geometric.cpp
# configure Qt
CONFIG += qt
CONFIG += link_prl qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

View File

@ -60,26 +60,26 @@ int main(int argc, char* argv[])
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
// 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);
graph->set_title("");
graph->setTitle("");
// 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
graph->set_Nx(NX);
graph->set_Ny(NY);
graph->setNx(NX);
graph->setNy(NY);
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
graph->set_x(-w/2.0);
graph->set_y(-h/2.0);
graph->setX(-w/2.0);
graph->setY(-h/2.0);
// width and height of the image in plot-axis-coordinates
graph->set_width(w);
graph->set_height(h);
graph->setWidth(w);
graph->setHeight(h);
// color-map is "MATLAB"
graph->set_palette(JKQTPMathImageMATLAB);
graph->setPalette(JKQTPMathImageMATLAB);
// 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
graph->set_autoImageRange(true);
graph->setAutoImageRange(true);
@ -116,28 +116,28 @@ The result looks like this:
There are several ways to modify the plot:
1. You can set the color scale manually (here 0..2), by using
```
graph->set_autoImageRange(false);
graph->set_imageMin(0);
graph->set_imageMax(2);
graph->setAutoImageRange(false);
graph->setImageMin(0);
graph->setImageMax(2);
```
instead of
```
graph->set_autoImageRange(true);
graph->setAutoImageRange(true);
```
from above. The result will look like this:<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.
2. If you set the color-range to 0.1 .. 0.8 with
```
graph->set_autoImageRange(false);
graph->set_imageMin(0.1);
graph->set_imageMax(0.8);
graph->setAutoImageRange(false);
graph->setImageMin(0.1);
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>
![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
- `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)
- `JKQTPMathImageTransparent`: draw pixels transparent<br>
![jkqtplotter_simpletest_imageplot__smallscaletransparent](../../screenshots/jkqtplotter_simpletest_imageplot__smallscaletransparent.png)

View File

@ -61,30 +61,30 @@ int main(int argc, char* argv[])
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
// 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);
graph->set_title("");
graph->setTitle("");
// 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
graph->set_Nx(NX);
graph->set_Ny(NY);
graph->setNx(NX);
graph->setNy(NY);
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
graph->set_x(-w/2.0);
graph->set_y(-h/2.0);
graph->setX(-w/2.0);
graph->setY(-h/2.0);
// width and height of the image in plot-axis-coordinates
graph->set_width(w);
graph->set_height(h);
graph->setWidth(w);
graph->setHeight(h);
// color-map is "MATLAB"
graph->set_palette(JKQTPMathImageMATLAB);
graph->setPalette(JKQTPMathImageMATLAB);
// 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
graph->set_autoImageRange(true);
graph->setAutoImageRange(true);
// you can set the color-scale range manually by using:
// graph->set_autoImageRange(false);
// graph->set_imageMin(0);
// graph->set_imageMax(10);
// graph->setAutoImageRange(false);
// graph->setImageMin(0);
// graph->setImageMax(10);
// 5. add the graphs to the plot, so it is actually displayed

View File

@ -2,7 +2,7 @@
SOURCES = jkqtplotter_simpletest_imageplot.cpp
# configure Qt
CONFIG += qt
CONFIG += link_prl qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

View File

@ -54,29 +54,29 @@ int main(int argc, char* argv[])
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
// 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);
graph->set_title("");
graph->setTitle("");
// image column with the data
graph->set_imageColumn(cImage);
graph->setImageColumn(cImage);
// now set the modifier image:
graph->set_modifierColumn(cModifier);
graph->set_autoModifierRange(true);
graph->setModifierColumn(cModifier);
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):
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
graph->set_Nx(NX);
graph->set_Ny(NY);
graph->setNx(NX);
graph->setNy(NY);
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
graph->set_x(-NX/2.0);
graph->set_y(-NX/2.0);
graph->setX(-NX/2.0);
graph->setY(-NX/2.0);
// width and height of the image in plot-axis-coordinates
graph->set_width(NX);
graph->set_height(NY);
graph->setWidth(NX);
graph->setHeight(NY);
// 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
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)
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.

View File

@ -55,29 +55,29 @@ int main(int argc, char* argv[])
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
// 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);
graph->set_title("");
graph->setTitle("");
// image column with the data
graph->set_imageColumn(cImage);
graph->setImageColumn(cImage);
// now set the modifier image:
graph->set_modifierColumn(cModifier);
graph->set_autoModifierRange(true);
graph->setModifierColumn(cModifier);
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):
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
graph->set_Nx(NX);
graph->set_Ny(NY);
graph->setNx(NX);
graph->setNy(NY);
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
graph->set_x(-NX/2.0);
graph->set_y(-NX/2.0);
graph->setX(-NX/2.0);
graph->setY(-NX/2.0);
// width and height of the image in plot-axis-coordinates
graph->set_width(NX);
graph->set_height(NY);
graph->setWidth(NX);
graph->setHeight(NY);
// 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
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
plot.show();
plot.resize(500,500);
plot.resize(600,600);
plot.setWindowTitle("JKQTPColumnMathImage");

View File

@ -2,7 +2,7 @@
SOURCES = jkqtplotter_simpletest_imageplot_modifier.cpp
# configure Qt
CONFIG += qt
CONFIG += link_prl qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

View File

@ -1,5 +1,5 @@
# 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):
```.cpp
@ -52,27 +52,27 @@ int main(int argc, char* argv[])
// 3. create a graph (JKQTPMathImage) with referencing the data created above as data
// 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);
graph->set_title("");
graph->setTitle("");
// 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)
graph->set_x(-w/2.0);
graph->set_y(-h/2.0);
graph->setX(-w/2.0);
graph->setY(-h/2.0);
// width and height of the image in plot-axis-coordinates
graph->set_width(w);
graph->set_height(h);
graph->setWidth(w);
graph->setHeight(h);
// color-map is "BLUEYELLOW"
graph->set_palette(JKQTPMathImageBLUEYELLOW);
graph->setPalette(JKQTPMathImageBLUEYELLOW);
// 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
graph->set_autoImageRange(true);
graph->setAutoImageRange(true);
// you can set the color-scale range manually by using:
// graph->set_autoImageRange(false);
// graph->set_imageMin(0);
// graph->set_imageMax(10);
// graph->setAutoImageRange(false);
// graph->setImageMin(0);
// graph->setImageMax(10);
// 4. add the graphs to the plot, so it is actually displayed

View File

@ -53,27 +53,27 @@ int main(int argc, char* argv[])
// 3. create a graph (JKQTPMathImage) with referencing the data created above as data
// 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);
graph->set_title("");
graph->setTitle("");
// 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)
graph->set_x(-w/2.0);
graph->set_y(-h/2.0);
graph->setX(-w/2.0);
graph->setY(-h/2.0);
// width and height of the image in plot-axis-coordinates
graph->set_width(w);
graph->set_height(h);
graph->setWidth(w);
graph->setHeight(h);
// color-map is "BLUEYELLOW"
graph->set_palette(JKQTPMathImageBLUEYELLOW);
graph->setPalette(JKQTPMathImageBLUEYELLOW);
// 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
graph->set_autoImageRange(true);
graph->setAutoImageRange(true);
// you can set the color-scale range manually by using:
// graph->set_autoImageRange(false);
// graph->set_imageMin(0);
// graph->set_imageMax(10);
// graph->setAutoImageRange(false);
// graph->setImageMin(0);
// graph->setImageMax(10);
// 4. add the graphs to the plot, so it is actually displayed

View File

@ -7,7 +7,7 @@ TARGET = jkqtplotter_simpletest_imageplot_nodatastore
SOURCES = jkqtplotter_simpletest_imageplot_nodatastore.cpp
# configure Qt
CONFIG += qt
CONFIG += link_prl qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

View File

@ -65,30 +65,30 @@ int main(int argc, char* argv[])
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
// 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);
graph->set_title("");
graph->setTitle("");
// 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
graph->set_Nx(airydisk.cols);
graph->set_Ny(airydisk.rows);
graph->setNx(airydisk.cols);
graph->setNy(airydisk.rows);
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
graph->set_x(-w/2.0);
graph->set_y(-h/2.0);
graph->setX(-w/2.0);
graph->setY(-h/2.0);
// width and height of the image in plot-axis-coordinates
graph->set_width(w);
graph->set_height(h);
graph->setWidth(w);
graph->setHeight(h);
// color-map is "MATLAB"
graph->set_palette(JKQTPMathImageMATLAB);
graph->setPalette(JKQTPMathImageMATLAB);
// 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
graph->set_autoImageRange(true);
graph->setAutoImageRange(true);
// you can set the color-scale range manually by using:
// graph->set_autoImageRange(false);
// graph->set_imageMin(0);
// graph->set_imageMax(10);
// graph->setAutoImageRange(false);
// graph->setImageMin(0);
// graph->setImageMax(10);
// 5. add the graphs to the plot, so it is actually displayed

View File

@ -64,30 +64,30 @@ int main(int argc, char* argv[])
// 4. create a graph (JKQTPColumnMathImage) with the column created above as data
// 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);
graph->set_title("");
graph->setTitle("");
// 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
graph->set_Nx(airydisk.cols);
graph->set_Ny(airydisk.rows);
graph->setNx(airydisk.cols);
graph->setNy(airydisk.rows);
// where does the image start in the plot, given in plot-axis-coordinates (bottom-left corner)
graph->set_x(-w/2.0);
graph->set_y(-h/2.0);
graph->setX(-w/2.0);
graph->setY(-h/2.0);
// width and height of the image in plot-axis-coordinates
graph->set_width(w);
graph->set_height(h);
graph->setWidth(w);
graph->setHeight(h);
// color-map is "MATLAB"
graph->set_palette(JKQTPMathImageMATLAB);
graph->setPalette(JKQTPMathImageMATLAB);
// 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
graph->set_autoImageRange(true);
graph->setAutoImageRange(true);
// you can set the color-scale range manually by using:
// graph->set_autoImageRange(false);
// graph->set_imageMin(0);
// graph->set_imageMax(10);
// graph->setAutoImageRange(false);
// graph->setImageMin(0);
// graph->setImageMax(10);
// 5. add the graphs to the plot, so it is actually displayed

View File

@ -2,7 +2,7 @@
SOURCES = jkqtplotter_simpletest_imageplot_opencv.cpp
# configure Qt
CONFIG += qt
CONFIG += link_prl qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

View File

@ -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:
```.cpp
JKQTPImpulsesVerticalGraph* graph=new JKQTPImpulsesVerticalGraph(&plot);
graph->set_xColumn(columnX);
graph->set_yColumn(columnY);
graph->setXColumn(columnX);
graph->setYColumn(columnY);
graph->setLineWidth(2);
graph->set_color(QColor("red"));
graph->set_title(QObject::tr("$\\cos(x)\\cdot\\exp(-x/10)$"));
graph->setColor(QColor("red"));
graph->setTitle(QObject::tr("$\\cos(x)\\cdot\\exp(-x/10)$"));
plot.addGraph(graph);
```
@ -39,11 +39,11 @@ The result looks like this:
There is an alternative class `JKQTPImpulsesHorizontalGraph` which draws horizontal impulse plots:
```.cpp
JKQTPImpulsesHorizontalGraph* graph=new JKQTPImpulsesHorizontalGraph(&plot);
graph->set_yColumn(columnX);
graph->set_xColumn(columnY);
graph->setYColumn(columnX);
graph->setXColumn(columnY);
graph->setLineWidth(2);
graph->set_color(QColor("blue"));
graph->set_title(QObject::tr("$\\cos(x)\\cdot\\exp(-x/10)$"));
graph->setColor(QColor("blue"));
graph->setTitle(QObject::tr("$\\cos(x)\\cdot\\exp(-x/10)$"));
```
This code snippet results in a plot like this:

View File

@ -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:
JKQTPImpulsesVerticalGraph* graph=new JKQTPImpulsesVerticalGraph(&plot);
graph->set_xColumn(columnX);
graph->set_yColumn(columnY);
graph->setXColumn(columnX);
graph->setYColumn(columnY);
graph->setLineWidth(2);
graph->set_color(QColor("red"));
graph->set_title(QObject::tr("$\\cos(x)\\cdot\\exp(-x/10)$"));
graph->setColor(QColor("red"));
graph->setTitle(QObject::tr("$\\cos(x)\\cdot\\exp(-x/10)$"));
// 5. add the graph to the plot, so it is actually displayed
plot.addGraph(graph);
@ -47,8 +47,8 @@ int main(int argc, char* argv[])
plot.getYAxis()->setAxisLabel(QObject::tr("y-axis"));
// 7. switch the grid off
plot.getXAxis()->set_drawGrid(false);
plot.getYAxis()->set_drawGrid(false);
plot.getXAxis()->setDrawGrid(false);
plot.getYAxis()->setDrawGrid(false);
// 8. autoscale the plot so the graph is contained
plot.zoomToFit();

View File

@ -2,7 +2,7 @@
SOURCES = jkqtplotter_simpletest_impulsesplot.cpp
# configure Qt
CONFIG += qt
CONFIG += link_prl qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

View File

@ -1,7 +1,7 @@
# 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.
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
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);
// copy data into datastore and immediately set the yColumn
graph->set_xColumn(columnX);
graph->set_yColumn(ds->addCopiedColumn(Y, "y"+QString::number(id)));
graph->setXColumn(columnX);
graph->setYColumn(ds->addCopiedColumn(Y, "y"+QString::number(id)));
// don't use symbols
graph->set_symbol(JKQTPNoSymbol);
graph->setSymbol(JKQTPNoSymbol);
// use one of different pens
graph->set_style(pens[id%pens.size()]);
graph->setStyle(pens[id%pens.size()]);
// set width of graph line
graph->setLineWidth(1.5);
// 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
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:
```.cpp
// 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,
// 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:
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
// 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,
// 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)
plot.getYAxis()->set_labelDigits(0);
plot.getYAxis()->setLabelDigits(0);
// 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:
plot.getYAxis()->set_tickLabelFontSize(10); // axis tick labels
plot.getYAxis()->set_minorTickLabelFontSize(7); // minor axis tick labels
plot.getYAxis()->set_labelFontSize(14); // axis label size
plot.getXAxis()->set_tickLabelFontSize(10); // axis tick labels
plot.getXAxis()->set_minorTickLabelFontSize(7); // minor axis tick labels
plot.getXAxis()->set_labelFontSize(14); // axis label size
plot.getYAxis()->setTickLabelFontSize(10); // axis tick labels
plot.getYAxis()->setMinorTickLabelFontSize(7); // minor axis tick labels
plot.getYAxis()->setLabelFontSize(14); // axis label size
plot.getXAxis()->setTickLabelFontSize(10); // axis tick labels
plot.getXAxis()->setMinorTickLabelFontSize(7); // minor axis tick labels
plot.getXAxis()->setLabelFontSize(14); // axis label size
// ... and finally set axis labels (using LaTeX notation and $...$ to improve rendering)
plot.getYAxis()->setAxisLabel("Amplitude $A/A_{stat}$");
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)
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)

View File

@ -45,18 +45,18 @@ int main(int argc, char* argv[])
JKQTPXYLineGraph* graph=new JKQTPXYLineGraph(&plot);
// copy data into datastore and immediately set the yColumn
graph->set_xColumn(columnX);
graph->set_yColumn(ds->addCopiedColumn(Y, "y"+QString::number(id)));
graph->setXColumn(columnX);
graph->setYColumn(ds->addCopiedColumn(Y, "y"+QString::number(id)));
// don't use symbols
graph->set_symbol(JKQTPNoSymbol);
graph->setSymbol(JKQTPNoSymbol);
// use one of different pens
graph->set_style(pens[id%pens.size()]);
graph->setStyle(pens[id%pens.size()]);
// set width of graph line
graph->setLineWidth(1.5);
// 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
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));
// 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,
// 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:
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
// 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,
// 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)
plot.getYAxis()->set_labelDigits(0);
plot.getYAxis()->setLabelDigits(0);
// 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:
plot.getYAxis()->set_tickLabelFontSize(10); // axis tick labels
plot.getYAxis()->set_minorTickLabelFontSize(7); // minor axis tick labels
plot.getYAxis()->set_labelFontSize(14); // axis label size
plot.getXAxis()->set_tickLabelFontSize(10); // axis tick labels
plot.getXAxis()->set_minorTickLabelFontSize(7); // minor axis tick labels
plot.getXAxis()->set_labelFontSize(14); // axis label size
plot.getYAxis()->setTickLabelFontSize(10); // axis tick labels
plot.getYAxis()->setMinorTickLabelFontSize(7); // minor axis tick labels
plot.getYAxis()->setLabelFontSize(14); // axis label size
plot.getXAxis()->setTickLabelFontSize(10); // axis tick labels
plot.getXAxis()->setMinorTickLabelFontSize(7); // minor axis tick labels
plot.getXAxis()->setLabelFontSize(14); // axis label size
// ... and finally set axis labels (using LaTeX notation and $...$ to improve rendering)
plot.getYAxis()->setAxisLabel("Amplitude $A/A_{stat}$");
plot.getXAxis()->setAxisLabel("relative driving frequency $\\eta=\\omega/\\omega_0$");

View File

@ -2,7 +2,7 @@
SOURCES = jkqtplotter_simpletest_logaxes.cpp
# configure Qt
CONFIG += qt
CONFIG += link_prl qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

View File

@ -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:
```.cpp
JKQTPXYLineGraph* graph1=new JKQTPXYLineGraph(&plot);
graph1->set_xColumn(columnX);
graph1->set_yColumn(columnY);
graph1->set_drawLine(true);
graph1->set_symbol(JKQTPNoSymbol);
graph1->set_title("one-colored spiral");
graph1->setXColumn(columnX);
graph1->setYColumn(columnY);
graph1->setDrawLine(true);
graph1->setSymbol(JKQTPNoSymbol);
graph1->setTitle("one-colored spiral");
plot.addGraph(graph1);
```
If you use `JKQTPXYParametrizedScatterGraph` instead of `JKQTPXYLineGraph`, you can also modify the color of the line-segments, connecting the datapoints:
```.cpp
JKQTPXYParametrizedScatterGraph* graph2=new JKQTPXYParametrizedScatterGraph(&plot2);
graph2->set_xColumn(columnX);
graph2->set_yColumn(columnY);
graph2->set_colorColumn(columnR);
graph2->set_palette(JKQTPMathImageMATLAB);
graph2->set_symbol(JKQTPNoSymbol);
graph2->set_drawLine(true);
graph2->set_title("colored spiral");
graph2->get_colorBarRightAxis()->setAxisLabel("color scale radius $r(\\phi)$");
graph2->setXColumn(columnX);
graph2->setYColumn(columnY);
graph2->setColorColumn(columnR);
graph2->setPalette(JKQTPMathImageMATLAB);
graph2->setSymbol(JKQTPNoSymbol);
graph2->setDrawLine(true);
graph2->setTitle("colored spiral");
graph2->getColorBarRightAxis()->setAxisLabel("color scale radius $r(\\phi)$");
plot2.addGraph(graph2);
```

View File

@ -43,24 +43,24 @@ int main(int argc, char* argv[])
// 3.1 the basic graph
JKQTPXYLineGraph* graph1=new JKQTPXYLineGraph(&plot);
graph1->set_xColumn(columnX);
graph1->set_yColumn(columnY);
graph1->set_drawLine(true);
graph1->set_symbol(JKQTPNoSymbol);
graph1->set_title("one-colored spiral");
graph1->setXColumn(columnX);
graph1->setYColumn(columnY);
graph1->setDrawLine(true);
graph1->setSymbol(JKQTPNoSymbol);
graph1->setTitle("one-colored spiral");
plot.addGraph(graph1);
// 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
JKQTPXYParametrizedScatterGraph* graph2=new JKQTPXYParametrizedScatterGraph(&plot2);
graph2->set_xColumn(columnX);
graph2->set_yColumn(columnY);
graph2->set_colorColumn(columnR);
graph2->set_palette(JKQTPMathImageMATLAB);
graph2->set_symbol(JKQTPNoSymbol);
graph2->set_drawLine(true);
graph2->set_title("colored spiral");
graph2->get_colorBarRightAxis()->setAxisLabel("color scale radius $r(\\phi)$");
graph2->setXColumn(columnX);
graph2->setYColumn(columnY);
graph2->setColorColumn(columnR);
graph2->setPalette(JKQTPMathImageMATLAB);
graph2->setSymbol(JKQTPNoSymbol);
graph2->setDrawLine(true);
graph2->setTitle("colored spiral");
graph2->getColorBarRightAxis()->setAxisLabel("color scale radius $r(\\phi)$");
plot2.addGraph(graph2);
@ -71,15 +71,15 @@ int main(int argc, char* argv[])
plot.getPlotter()->setAspectRatio(1);
plot.getXAxis()->setAxisLabel("x-axis");
plot.getYAxis()->setAxisLabel("y-axis");
plot.getXAxis()->set_drawGrid(false);
plot.getYAxis()->set_drawGrid(false);
plot.getXAxis()->setDrawGrid(false);
plot.getYAxis()->setDrawGrid(false);
plot.setXY(-15,15,-15,15);
plot2.getPlotter()->setMaintainAspectRatio(true);
plot2.getPlotter()->setAspectRatio(1);
plot2.getXAxis()->setAxisLabel("x-axis");
plot2.getYAxis()->setAxisLabel("y-axis");
plot2.getXAxis()->set_drawGrid(false);
plot2.getYAxis()->set_drawGrid(false);
plot2.getXAxis()->setDrawGrid(false);
plot2.getYAxis()->setDrawGrid(false);
plot2.setXY(-15,15,-15,15);

View File

@ -2,7 +2,7 @@
SOURCES = jkqtplotter_simpletest_parametriccurve.cpp
# configure Qt
CONFIG += qt
CONFIG += link_prl qt
QT += core gui xml svg
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport

View File

@ -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.
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
JKQTPXYParametrizedScatterGraph* graph1=new JKQTPXYParametrizedScatterGraph(&plot);
graph1->set_xColumn(columnX);
graph1->set_yColumn(columnY1);
graph1->set_symbolColumn(columnP);
graph1->set_drawLine(true);
graph1->set_color(QColor("blueviolet"));
graph1->set_title("1: symbol type");
graph1->setXColumn(columnX);
graph1->setYColumn(columnY1);
graph1->setSymbolColumn(columnP);
graph1->setDrawLine(true);
graph1->setColor(QColor("blueviolet"));
graph1->setTitle("1: symbol type");
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
// symbol size
JKQTPXYParametrizedScatterGraph* graph3=new JKQTPXYParametrizedScatterGraph(&plot);
graph3->set_xColumn(columnX);
graph3->set_yColumn(columnY3);
graph3->set_sizeColumn(columnS);
graph3->set_symbol(JKQTPFilledCircle);
graph3->set_drawLine(true);
graph3->set_title("3: symbol size");
graph3->setXColumn(columnX);
graph3->setYColumn(columnY3);
graph3->setSizeColumn(columnS);
graph3->setSymbol(JKQTPFilledCircle);
graph3->setDrawLine(true);
graph3->setTitle("3: symbol size");
plot.addGraph(graph3);
// line width
JKQTPXYParametrizedScatterGraph* graph6=new JKQTPXYParametrizedScatterGraph(&plot);
graph6->set_xColumn(columnX);
graph6->set_yColumn(columnY6);
graph6->setXColumn(columnX);
graph6->setYColumn(columnY6);
graph6->setLinewidthColumn(columnLW);
graph6->set_drawLine(true);
graph6->set_symbol(JKQTPNoSymbol);
graph6->set_title("6: line width");
graph6->setDrawLine(true);
graph6->setSymbol(JKQTPNoSymbol);
graph6->setTitle("6: line width");
plot.addGraph(graph6);
```
@ -60,46 +60,46 @@ Finally you can set the color of each symbol, based on data in the column `color
```.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).
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
JKQTPXYParametrizedScatterGraph* graph4=new JKQTPXYParametrizedScatterGraph(&plot);
graph4->set_xColumn(columnX);
graph4->set_yColumn(columnY4);
graph4->set_colorColumn(columnRGB);
graph4->set_colorColumnContainsRGB(true);
graph4->set_drawLine(true);
graph4->set_symbol(JKQTPFilledDownTriangle);
graph4->set_title("4: RGB-color");
graph4->setXColumn(columnX);
graph4->setYColumn(columnY4);
graph4->setColorColumn(columnRGB);
graph4->setColorColumnContainsRGB(true);
graph4->setDrawLine(true);
graph4->setSymbol(JKQTPFilledDownTriangle);
graph4->setTitle("4: RGB-color");
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`:
```.cpp
JKQTPXYParametrizedScatterGraph* graph2=new JKQTPXYParametrizedScatterGraph(&plot);
graph2->set_xColumn(columnX);
graph2->set_yColumn(columnY2);
graph2->set_colorColumn(columnC);
graph2->set_palette(JKQTPMathImageRYGB);
graph2->set_symbol(JKQTPFilledRect);
graph2->set_drawLine(true);
graph2->set_title("2: color");
graph2->get_colorBarRightAxis()->setAxisLabel("color scale for graph2");
graph2->setXColumn(columnX);
graph2->setYColumn(columnY2);
graph2->setColorColumn(columnC);
graph2->setPalette(JKQTPMathImageRYGB);
graph2->setSymbol(JKQTPFilledRect);
graph2->setDrawLine(true);
graph2->setTitle("2: color");
graph2->getColorBarRightAxis()->setAxisLabel("color scale for 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:
```.cpp
JKQTPXYParametrizedScatterGraph* graph5=new JKQTPXYParametrizedScatterGraph(&plot);
graph5->set_xColumn(columnX);
graph5->set_yColumn(columnY5);
graph5->set_colorColumn(columnC);
graph5->set_sizeColumn(columnS);
graph5->set_palette(JKQTPMathImageBLUEYELLOW);
graph5->set_drawLine(true);
graph5->set_title("5: color+size");
graph5->get_colorBarRightAxis()->setAxisLabel("color scale for graph5");
graph5->setXColumn(columnX);
graph5->setYColumn(columnY5);
graph5->setColorColumn(columnC);
graph5->setSizeColumn(columnS);
graph5->setPalette(JKQTPMathImageBLUEYELLOW);
graph5->setDrawLine(true);
graph5->setTitle("5: color+size");
graph5->getColorBarRightAxis()->setAxisLabel("color scale for graph5");
plot.addGraph(graph5);
```

View File

@ -60,50 +60,50 @@ int main(int argc, char* argv[])
// 3.1 for graph1, we use dataset X/Y1
// and the symbol type is choose according to the contents of column P:
JKQTPXYParametrizedScatterGraph* graph1=new JKQTPXYParametrizedScatterGraph(&plot);
graph1->set_xColumn(columnX);
graph1->set_yColumn(columnY1);
graph1->set_symbolColumn(columnP);
graph1->set_drawLine(true);
graph1->set_color(QColor("blueviolet"));
graph1->set_title("1: symbol type");
graph1->setXColumn(columnX);
graph1->setYColumn(columnY1);
graph1->setSymbolColumn(columnP);
graph1->setDrawLine(true);
graph1->setColor(QColor("blueviolet"));
graph1->setTitle("1: symbol type");
plot.addGraph(graph1);
// 3.2 for graph2, we use dataset X/Y2
// and the symbol color is choose according to the contents of column C
// and the actual colors are chose from palette JKQTPMathImageRYGB:
JKQTPXYParametrizedScatterGraph* graph2=new JKQTPXYParametrizedScatterGraph(&plot);
graph2->set_xColumn(columnX);
graph2->set_yColumn(columnY2);
graph2->set_colorColumn(columnC);
graph2->set_palette(JKQTPMathImageRYGB);
graph2->set_symbol(JKQTPFilledRect);
graph2->set_drawLine(true);
graph2->set_title("2: color");
graph2->get_colorBarRightAxis()->setAxisLabel("color scale for graph2");
graph2->setXColumn(columnX);
graph2->setYColumn(columnY2);
graph2->setColorColumn(columnC);
graph2->setPalette(JKQTPMathImageRYGB);
graph2->setSymbol(JKQTPFilledRect);
graph2->setDrawLine(true);
graph2->setTitle("2: color");
graph2->getColorBarRightAxis()->setAxisLabel("color scale for graph2");
plot.addGraph(graph2);
// 3.3 for graph3, we use dataset X/Y3
// and the symbol size is choose according to the contents of column S:
JKQTPXYParametrizedScatterGraph* graph3=new JKQTPXYParametrizedScatterGraph(&plot);
graph3->set_xColumn(columnX);
graph3->set_yColumn(columnY3);
graph3->set_sizeColumn(columnS);
graph3->set_symbol(JKQTPFilledCircle);
graph3->set_drawLine(true);
graph3->set_title("3: symbol size");
graph3->setXColumn(columnX);
graph3->setYColumn(columnY3);
graph3->setSizeColumn(columnS);
graph3->setSymbol(JKQTPFilledCircle);
graph3->setDrawLine(true);
graph3->setTitle("3: symbol size");
plot.addGraph(graph3);
// 3.4 for graph4, we use X/Y4
// and the symbol color is choose according to the contents of column RGB,
// which directly contains the RGB values, as set with qRgb():
JKQTPXYParametrizedScatterGraph* graph4=new JKQTPXYParametrizedScatterGraph(&plot);
graph4->set_xColumn(columnX);
graph4->set_yColumn(columnY4);
graph4->set_colorColumn(columnRGB);
graph4->set_colorColumnContainsRGB(true);
graph4->set_drawLine(true);
graph4->set_symbol(JKQTPFilledDownTriangle);
graph4->set_title("4: RGB-color");
graph4->setXColumn(columnX);
graph4->setYColumn(columnY4);
graph4->setColorColumn(columnRGB);
graph4->setColorColumnContainsRGB(true);
graph4->setDrawLine(true);
graph4->setSymbol(JKQTPFilledDownTriangle);
graph4->setTitle("4: RGB-color");
plot.addGraph(graph4);
// 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.
// The actual colors are chose from palette JKQTPMathImageBLUEYELLOW:
JKQTPXYParametrizedScatterGraph* graph5=new JKQTPXYParametrizedScatterGraph(&plot);
graph5->set_xColumn(columnX);
graph5->set_yColumn(columnY5);
graph5->set_colorColumn(columnC);
graph5->set_sizeColumn(columnS);
graph5->set_palette(JKQTPMathImageBLUEYELLOW);
graph5->set_drawLine(true);
graph5->set_title("5: color+size");
graph5->get_colorBarRightAxis()->setAxisLabel("color scale for graph5");
graph5->setXColumn(columnX);
graph5->setYColumn(columnY5);
graph5->setColorColumn(columnC);
graph5->setSizeColumn(columnS);
graph5->setPalette(JKQTPMathImageBLUEYELLOW);
graph5->setDrawLine(true);
graph5->setTitle("5: color+size");
graph5->getColorBarRightAxis()->setAxisLabel("color scale for graph5");
plot.addGraph(graph5);
// 3.6 for graph2, we use dataset X/Y6
// and the line width is set by column LW:
JKQTPXYParametrizedScatterGraph* graph6=new JKQTPXYParametrizedScatterGraph(&plot);
graph6->set_xColumn(columnX);
graph6->set_yColumn(columnY6);
graph6->setXColumn(columnX);
graph6->setYColumn(columnY6);
graph6->setLinewidthColumn(columnLW);
graph6->set_drawLine(true);
graph6->set_symbol(JKQTPNoSymbol);
graph6->set_title("6: line width");
graph6->setDrawLine(true);
graph6->setSymbol(JKQTPNoSymbol);
graph6->setTitle("6: line width");
plot.addGraph(graph6);
// 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:
JKQTPXYParametrizedScatterGraph* graph7=new JKQTPXYParametrizedScatterGraph(&plot);
graph7->set_xColumn(columnX);
graph7->set_yColumn(columnY7);
graph7->setXColumn(columnX);
graph7->setYColumn(columnY7);
graph7->setLinewidthColumn(columnLW);
graph7->set_drawLine(true);
graph7->set_colorColumn(columnC);
graph7->set_palette(JKQTPMathImageBLUEYELLOW);
graph7->set_symbol(JKQTPNoSymbol);
graph7->set_colorBarRightVisible(false);
graph7->set_colorBarTopVisible(false);
graph7->set_title("7: color+line width");
graph7->setDrawLine(true);
graph7->setColorColumn(columnC);
graph7->setPalette(JKQTPMathImageBLUEYELLOW);
graph7->setSymbol(JKQTPNoSymbol);
graph7->setColorBarRightVisible(false);
graph7->setColorBarTopVisible(false);
graph7->setTitle("7: color+line width");
plot.addGraph(graph7);
// 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.getXAxis()->setAxisLabel("x-axis");
plot.getYAxis()->setAxisLabel("y-axis");
plot.getXAxis()->set_drawGrid(false);
plot.getYAxis()->set_drawGrid(false);
plot.getXAxis()->setDrawGrid(false);
plot.getYAxis()->setDrawGrid(false);
plot.zoomToFit();
// 5. show plotter and make it a decent size

Some files were not shown because too many files have changed in this diff Show More