简体   繁体   中英

Plotting Graphs with gtk3 in C

I'm looking for an alternative to gtkdatabox since it is using obsolete stuff. I have got a GUI, made with Glade (3.20), that shall display some data in a 2D-graph. It is all written in C so 'matplotlib' isn't the tool I am looking for, is it? When I tried to do this with gtkdatabox, I got this message while compiling:

error: unknown type name ‘GdkGC’

As this page quotes, this type isn't available any longer.

GTK+ 3 (as well as GTK+ 2 since 2.8) uses cairo for drawing. If those are simple graphs, you may draw them directly with cairo.

Here are code examples of a simple function drawn with GTK+ and cairo:

EDIT:

There's also some tries of simple plotting libraries out there on the web. One of them is slope:

Never used it, but at least it uses GTK+, cairo and last commit is 2 months old. Of course, like GtkDataBox, that's not a widget maintained by the GTK+ project, so you're still at the mercy of the maintainer willingness to maintain his software.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM