

A new feature in KDE 3.4 is that you can write scripts for KmPlot using DBus in KDE 4. For example, if you want to define a new function f(x)=2sin x+3cos x, set its line width to 20 and then draw it, you type in a console:
qdbus org.kde.kmplot-PID /parser org.kde.kmplot.Parser.addFunction "f(x)=2sin x+3cos x" "" As a result, the new function's id number will be returned, or -1 if the function could not be defined.
qdbus org.kde.kmplot-PID /parser org.kde.kmplot.Parser.setFunctionFLineWidth ID 20 This command sets the function with the id number ID the line width to 20.
qdbus org.kde.kmplot-PID /view org.kde.kmplot.View.drawPlot This command repaints the window so that the function get visible.
A list of the available functions:
Load the file url.
Returns true if any changes are done.
If there are any unsaved changes, a dialog appears to save, discard or cancel the plots.
Opens the coordinate system edit dialog.
Shows/hides parameter slider window.
Saves the functions (opens the save dialog if it is a new file).
The same as choosing -> in the menu.
Opens the print dialog.
The same as choosing -> in the menu.
Opens the export dialog.
Opens the settings dialog.
Shows the predefined math functions in the handbook.
The same as choosing -> in the menu.
The same as choosing -> in the menu.
The same as choosing -> in the menu.
The same as choosing -> in the menu.
Adds a new function with the expressions f_str0 and f_str1. If the expression does not contain a function name, it will be auto-generated. The id number of the new function is returned, or -1 if the function could not be defined.
Removes the function with the id number id. If the function could not be deleted, false is returned, otherwise true.
Sets the expression for the function with the id number id to f_str. Returns true if it succeed, otherwise false.
Returns the number of functions (parametric functions are calculated as two).
Returns a list with all functions.
Returns the id number of f_str or -1 if the function name f_str was not found.
Returns true if the function with the ID id is visible, otherwise false.
Returns true if the first derivative of the function with the ID id is visible, otherwise false.
Returns true if the second derivative of the function with the ID id is visible, otherwise false.
Returns true if the integral of the function with the ID id is visible, otherwise false.
Shows the function with the ID id if visible is true. If visible is false, the function will be hidden. True is returned if the function exists, otherwise false
Shows the first derivative of the function with the ID id if visible is true. If visible is false, the function will be hidden. True is returned if the function exists, otherwise false.
Shows the second derivative of the function with the ID id if visible is true. If visible is false, the function will be hidden. True is returned if the function exists, otherwise false.
Shows the integral of the function with the ID id if visible is true. If visible is false, the function will be hidden. True is returned if the function exists, otherwise false.
Returns the function expression of the function with the ID id. If the function not exists, an empty string is returned instead.
Returns the line width of the function with the ID id. If the function not exists, 0 is returned.
Returns the line width of the first derivative of the function with the ID id. If the function not exists, 0 is returned.
Returns the line width of the first derivative of the function with the ID id. If the function not exists, 0 is returned.
Returns the line width of the integral of the function with the ID id. If the function not exists, 0 is returned.
Sets the line width of the function with the ID id to linewidth. True is returned if the function exists, otherwise false.
Sets the line width of the first derivative of the function with the ID id to linewidth. True is returned if the function exists, otherwise false.
Sets the line width of the second derivative of the function with the ID id to linewidth. True is returned if the function exists, otherwise false.
Sets the line width of the integral of the function with the ID id to linewidth. True is returned if the function exists, otherwise false.
Returns a list with all the parameter values for the function with the ID id.
Adds the parameter value new_parameter to the function with the ID id. True is returned if the operation succeed, otherwise false.
Removes the parameter value remove_parameter from the function with the ID id. True is returned if the operation succeed, otherwise false.
Returns the minimum plot range value of the function with the ID id. If the function not exists or if the minimum value is not definied, an empty string is returned.
Returns the maximum plot range value of the function with the ID id. If the function not exists or if the maximum value is not definied, an empty string is returned.
Sets the minimum plot range value of the function with the ID id to min. True is returned if the function exists and the expression is valid, otherwise false.
Sets the maximum plot range value of the function with the ID id to max. True is returned if the function exists and the expression is valid, otherwise false.
Returns the initial x point for the integral of the function with the ID id. If the function not exists or if the x-point-expression is not definied, an empty string is returned.
Returns the initial y point for the integral of the function with the ID id. If the function not exists or if the y-point-expression is not definied, an empty string is returned.
Sets the initial x and y point for the integral of the function with the ID id to x and y. True is returned if the function exists and the expression is valid, otherwise false.
If KmPlot currently is drawing a function, the procedure will stop.
Redraws all functions.