简体   繁体   English

在C中使用gtk3绘制图

[英]Plotting Graphs with gtk3 in C

I'm looking for an alternative to gtkdatabox since it is using obsolete stuff. 我正在寻找gtkdatabox的替代方法,因为它使用的是过时的东西。 I have got a GUI, made with Glade (3.20), that shall display some data in a 2D-graph. 我有一个用Glade(3.20)制作的GUI,它将在2D图形中显示一些数据。 It is all written in C so 'matplotlib' isn't the tool I am looking for, is it? 这些都是用C编写的,所以“ matplotlib”不是我要找的工具,是吗? When I tried to do this with gtkdatabox, I got this message while compiling: 当我尝试使用gtkdatabox进行此操作时,在编译时收到以下消息:

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. GTK + 3(以及2.8之后的GTK + 2)使用开罗进行绘制。 If those are simple graphs, you may draw them directly with cairo. 如果这些是简单图形,则可以直接用cairo绘制它们。

Here are code examples of a simple function drawn with GTK+ and cairo: 以下是使用GTK +和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. 从未使用过它,但是至少它使用了GTK +,cairo,并且最后一次提交已使用了2个月。 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. 当然,像GtkDataBox一样,它不是由GTK +项目维护的小部件,因此,维护者仍然不愿意维护他的软件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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