Chapter 5. Developer's Guide to Kpl

Table of Contents

Functions
D-Bus Interface
newPlot
openPlot
openData
savePlot
savePS
exportImage
printPlot
setAddFilesOption
setPathOption
setBoundingBoxOption
setPageFormat
setColors
setOutputFormat
setAutoplot
setAutofit
loadAutofitPar
setAutofitPar
enableFitPar
loadErrModPar
setErrModPar
deleteItem
moveItem
activateItem
newFrameItem
newAutoFrameItem
newArrayItem
newFunItem
newParFunItem
newSplineItem
newArray3DItem
newFun3DItem
newImageItem
newLegendItem
newTextItem
newLineItem
newArrowItem
newArcItem
newRectangleItem
newEllipseItem
newScaleBarItem
autoScaleFrame
loadPar
setPar
setArrayRange
addFitItems
addFunFitItem
fit
addSplineFitItem
splineFit
chiSquare
saveFitPar
exportValues
Class Library libkpl

Functions

User defined C or C++ functions for graphical presentations of ordinary and parametric functions and for parameter fits are used by Kpl as shared libraries. These functions return a double value and expect a double function argument and a pointer to a double array of up to 20 parameters:

double myfunction(double x, const double *p);

Functions for three-dimensional presentations of surfaces return a double value and expect two double function arguments and a pointer to a double array of up to 20 parameters:

double my3Dfunction(double x, double z, const double *p);

Module definition files (of the type .def and the same name as source and library files) can be used as a lookup table by Kpl. They correspond to the output of the program nm.

In the directory $KDEDIR/lib/qt5/plugins/kpl or $KDEDIR/lib64/qt5/plugins/kpl in case of 32 or 64 bit installations, respectively, a shared library fkt.so as well as the source file fkt.c, the module definition file fkt.def, and a make file Makefile.fkt are already installed. The files fkt.c and Makefile.fkt may be used as examples and have to be customized in this case. The example plot files demo2.plo, demo3.plo, demo4.plo, demo5.plo, demo6.plo and demo11.plo in the same directory make use of the functions of fkt.so.

As an example for multidimensional parameter fits, a C++ source file fcompl.cpp as well as the corresponding files fcompl.so, fcompl.def, and Makefile.fcompl are provided in the same directory. Here two double valued functions make use of the real and imaginary part of a complex function, implemented with the class complex. The example plot files demo7.plo and demo8.plo make use of the functions of fcompl.so.