使用 GD 绘制图表

发布于 2024-10-17 08:02:48 字数 631 浏览 3 评论 0原文

就这样吧。

我想了很长时间,但还没有真正能够提出一个合适的方法来做到这一点。我还没有实现任何东西,因为我仍在设计这个东西。

我的想法是,我抓取一个网站的内部链接,我解决了这个问题,这很容易,但是在抓取之后,我最终得到一个包含大量链接的数组,以及这些特定链接在我抓取的网站上出现的次数(以及它们如何连接)。

有了这个巨大的数组,我想以某种方式绘制一个图表。假设我可以正确处理数据,这里真正的问题是如何使用 GD 库在图像中绘制它。

我想如果元素少于 12 个,我可以将它们对齐在一个单位圆上,将它们间隔为一个圆,然后相应地连接它们,因此最多 12 个元素应该不是问题,但如果元素超过 12 个,让它们像这样排列起来会很棒 http://nayena.com/stackoverflow/graph.png< /a> 或者好吧,这只是一个粗略的图,但我想这只是为了证明一点。

因此,我在这里寻求指导或技巧,以将数学简化为以良好的方式排列内容。

我以前制作过条形图,所以我对用 GD 做数学没什么经验。如果可能的话,我宁愿不使用某些绘图仪库 - 最后,它让我更好地理解事情应该如何。

Here it goes.

I have been thinking about this for a long time, and havent really been able to put up a proper way to do it yet. I havent implemented anything yet, as im still designing the thing.

The idea is that i crawl a website for internal links, i got this settled, its easy, but after the crawling, i end up with an array with lots of links, and how many times those particular link appears on the site that i crawled (and how they're connected).

With this huge array, i want to draw a graph somehow. Assuming i can handle the data correctly, the real question here is how i can draw this in a image by the use of the GD library.

I figured if theres less than 12 elements, i can align them up on a unit circle spacing them up as a circle and then connecting them accordingly, so anything up to 12 elements shouldn't be a problem, but if theres more than 12, it could be awesome getting them lined up like this http://nayena.com/stackoverflow/graph.png Or well, thats just a rough drawing, but i guess its just to prove a point.

So i'm here looking for guidance or tips towards getting the math down to getting the stuff lined up in a good way.

I have previously made bar-graphs, so i have little experience doing math with GD. If possible, id prefer not using some plotter-library - in the end, it gives me a better understanding on how things are supposed to be.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南巷近海 2024-10-24 08:02:49

这是 CS/IS 的一个完整子领域,有专门讨论图形绘制主题的教科书、研究论文和研讨会。

你可以将整个职业生涯投入到如何绘制图表上。

This is a whole subfield of CS/IS, with textbooks, research papers and symposia devoted to the subject of graph drawing.

You could devote an entire career to how to plot a graph.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文