JKQtPlotter/tools/jkqtplotter_doc_imagegenerator
2024-01-23 13:09:37 +01:00
..
CMakeLists.txt NEW/BREAKING: provide general targets JKQTPlotter5/6::JKQTPlotter5/6, JKQTPlotter5/6::JKQTMathText5/6, ... which are independent of the type of build (shared/static) 2024-01-16 13:07:08 +01:00
jkqtplotter_doc_imagegenerator_and_lib.pro added command-line tool that auto-generates images for the JKQTPLotter documentation, implemented auto-generated plot-symbols 2022-09-02 22:59:41 +02:00
jkqtplotter_doc_imagegenerator.cpp fixed several compile warnings 2024-01-23 13:09:37 +01:00
jkqtplotter_doc_imagegenerator.pro added command-line tool that auto-generates images for the JKQTPLotter documentation, implemented auto-generated plot-symbols 2022-09-02 22:59:41 +02:00
README.md dox update/fix 2022-09-19 21:55:12 +02:00

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");