mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-11-15 18:15:52 +08:00
b0df7a1fd7
NEW/BREAKING: refactor CMake-Code, so static/dynamic switch is done via <code>BUILD_SHARED_LIBS</code>, which retires <code>JKQtPlotter_BUILD_STATIC_LIBS</code>, <code>JKQtPlotter_BUILD_SHARED_LIBS</code> and removes the capability to build static and shared libraries in one location (fixes issue #104) NEW: prepareed library for CMake's <a href="https://cmake.org/cmake/help/latest/module/FetchContent.html">FetchContent</a>-API NEW: the different sub-libraries JKQTPlotter, JKQTFastPlotter (DEPRECATED), JKQTMath, JKQTMathText can be activated/deactivated with CMake options JKQtPlotter_BUILD_LIB_JKQTPLOTTER, JKQtPlotter_BUILD_LIB_JKQTFASTPLOTTER, JKQtPlotter_BUILD_LIB_JKQTMATHTEXT, JKQtPlotter_BUILD_LIB_JKQTMATH |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
jkqtplotter_doc_imagegenerator_and_lib.pro | ||
jkqtplotter_doc_imagegenerator.cpp | ||
jkqtplotter_doc_imagegenerator.pro | ||
README.md |
Tool (JKQTMathText): Command-Line Utility jkqtplotter_doc_imagegenerator
This command-line tool is used to generate images for the documentation.
For some of its options, it uses a JKQTBasePlotter to directly render an image without creating a visible window. The code then looks like this:
First we generate the JKQTBasePlotter object and add some data to the internal JKQTPDatastore
JKQTBasePlotter plot(true);
JKQTPDatastore* ds=plot.getDatastore();
size_t cx=ds->addCopiedColumn(QVector<double>{-1.5,-0.5,0.5,1.5,2.5},"x");
size_t cy=ds->addCopiedColumn(QVector<double>{-0.75,-0.3,-0.05,0.2,0.65},"y");
Now we set the range of x/y plot coordinates ...
plot.setXY(-0.8,2.2,-0.5,0.7);
and the size of the widget, i.e. the size of the plot in the windowing system.
plot.setWidgetSize(150,50);
Now we can add graphs to the plotter, e.g.
JKQTPXYLineGraph* g=new JKQTPXYLineGraph(&plot);
g->setXColumn(cx);
g->setYColumn(cy);
plot.addGraph(g);
Finally we store an image of the plot as PNG-file:
plot.saveAsPixelImage("output.png", false, "png");