This app, written in C and GTK 4 is used to draw graphs of one variable in a given range. The app implements simple rasterization and microsampling thus graphs looks clear. This app was tested on Windows 10/11 and Linux.
This repo contains only the display engine. The parser and evaluator was moved to different repo.
- download and install MSYS2,
- download and install GTK (GTK 4.0),
- you will also need programs such as: gcc, make, pkg-config, git, bash and so on,
- in bash type: 'bash install.sh', you will need an internet connection,
- run program with './graphs.exe'.
- download and install GTK4 for your distribution
- download and install gcc, make, pkg-config, through your package manager
- in bash type: 'bash install.sh', you will need an internet connection,
- run program with './graphs'.
In the program, you can enter 4 equations at once, which will be displayed on a graph. The graphs have different colors, blue, red, green and purple, respectively.
Instructions were moved to another repo.
In the app, there are multiple settings to manage how the graphs should be printed on the screen.
Text field 'interval' accepts one positive number. The program will draw a graph on interval form -number to +number.
The scale text field accepts one number (it can be an integer or a number with a finite decimal expansion). The scale is responsible for the counter-domain on which the function will be drawn. With a scale of 1.0, the smallest value you can see is f(x) = -300 and the largest is +300, with a scale of 2.0 the interval is (-150, 150), with the default scale of 30.0 the interval is (-10, 10).
Rasterization is responsible for connecting the dots on the graph, so that the displayed graph is a continuous line. This option is recommended when the graph is rapidly increasing or decreasing, without rasterization it would be difficult to observe the course of the function. Note that rasterization at discontinuous points may behave unpredictably, for example, for the expression 'floor(x)' the functionality will draw vertical lines at points f(k), where k is an integer, which should not happen. Rasterization has little effect on performance and is enabled by default.
Microsampling only works when rasterization is enabled. The functionality performs additional tests at discontinuity points and decides whether to draw a line connecting the dots or not. The functionality should better reflect the graphs of complex functions. Microsampling has a big impact on performance and is disabled by default.
The program includes the following modules:
- eval.h, eval.c, parse.h, parse.c -> interpreter stubs
- draw.h and draw.c -> display module
- main.c -> interface module
- Add CSS to exisitning GTK 4 controls
- Saving graph to bitmap file
- Terminal parameters
- Setting menu and "What's new" window
- Adding custom math constants
- Automatic updates
The app is available under MIT License.