基于 GTK 的图?
我希望能够使用 GTK+ 制作折线图,但我不确定如何实现这一点。有人有任何提示或技巧吗?
I want to be able to make a line graph using GTK+ but I'm unsure how to approach this. Has anyone got any hints or tips?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
编辑:
以下是该程序的 GTK+ 2 和 GTK+ 3 版本:
https://github.com/liberforce/gtk-samples/tree/master/c/gtk2-graph
https://github.com /liberforce/gtk-samples/tree/master/c/gtk3-graph
原始答案:
这是 GTK2应用程序使用 cairo 绘制一个简单的数学函数:
Edit:
Here are GTK+ 2 and GTK+ 3 versions of that program:
https://github.com/liberforce/gtk-samples/tree/master/c/gtk2-graph
https://github.com/liberforce/gtk-samples/tree/master/c/gtk3-graph
Original answer:
Here's a GTK2 application using cairo to draw a simple math function:
我只是想为这个常见请求添加更多替代方案。
这是 Gnumeric 和 AbiWord 使用的库,因此它得到积极维护并且相当稳定:是当前可用的最明智的替代方案之一。不幸的是,没有官方主页并且缺乏初学者文档。
最近更换了维护者,所以未来存在一些不确定性。它曾经是在线图中渲染大量数据的一个很好的解决方案。
这是 GTK+ 中绘制图表的事实上的旧标准。跳转到 GTK+2 似乎对这个项目来说是致命的。
有点斯巴达式的风格,但适合简单的事情。
除此之外,许多项目在内部实施某种 GTK+ 图表。除了尚未引用的 Gnuplot 之外,还有 Gwyddion 和gretl。我很确定我错过了很多其他人。
总之,GTK+ 世界中的图表既没有普遍共识,也没有事实上的标准……
I just want to add some more alternatives to this common request.
This is the library used by Gnumeric and AbiWord, so it is actively maintained and fairly stable: one of the sanest alternative currently available. Unfortunately, there is no official home page and it lacks beginners documentation.
It recently changed the maintainer, so there is some uncertainty in the future. It used to be a good solution for rendering a lot of data in line plots.
This was the old de-facto standard of plotting charts in GTK+. The jump to GTK+2 seems to have been fatal to this project.
Somewhat spartans but good for simple stuff.
Other than that, a lot of projects implement internally some kind of GTK+ charting. Other than the yet cited Gnuplot, there is also Gwyddion and gretl. And I'm pretty sure I'm missing tons of others.
In conclusion, there is no general consensus nor a de-facto standard for charting in the GTK+ world...
看看 gnuplot 有一些 C++ 与 gnuplot 交互的库,它可以完成您正在寻找的事情,然后再做一些事情。如果您曾经使用过 gnuplot,那么它会非常容易使用。
Have a look at the gnuplot there are some C++ libraries that interface with gnuplot, which do what you are looking for and then some. It is very easy to use if you've ever used gnuplot.