用于绘制区域的 Javascript 图形库
作为一名风帆冲浪爱好者,我对接下来几周的风势很感兴趣。 为此,我一直在编写一个小应用程序来抓取一个流行的天气网站(仅供个人使用 - 不转发信息或任何内容)并将数据整理成一个图表,以便我可以轻松地看到什么时候值得前往出去。
我的后端正在工作,但需要一种显示数据的方法。 我的刮刀目前为我提供了两个系列的数据,这些数据告诉我一般风有多强以及阵风可能有多强。 接下来我想做的是将这两个数据集显示为图表中的一对线,并对它们之间的区域进行着色。
我正在考虑使用flot 库之类的东西来显示数据。 唯一的问题是我看不到一种方法来对两条线之间的区域进行着色?
如果有人对如何在 flot 或其他库或图形技术中执行此操作有建议(我的服务器上有 DJango,所以任何 pythonic 或 javascripty 都应该没问题),我很想听听他们的建议。 理想情况下,这将是一个 JavaScript 解决方案,以避免提供图像。
As a keen windsurfer, I'm interested in how windy the next few weeks are going to be. To that end, I've been writing a little app to scrape a popular weather site (personal use only - not relaying the information or anything) and collate the data into a single graph so that I can easily see when's going to be worth heading out.
I have the back end working but need a way to display the data. My scraper currently gives me two series of data which tell me how strong the general wind is and how strong it's likely to gust to. What I'd like to do next is display those two data sets as a pair of lines in a graph and shade the region between them.
I was considering using something like the flot library to display the data. The only problem is that I can't see a way to shade an area between two lines?
If anyone has suggestions of how to do this in flot or other libraries or graphing techniques (I have DJango on my server so anything pythonic or javascripty should be fine), I'd be interested to hear them. Ideally this will be a javascript solution to avoid having to serve up images.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查看 Google 图表 API。 他们让这种事情变得非常容易。 如果没有一些示例代码,我很难给你一个例子,但谷歌在文档上有一个很好的例子。
Take a look at the Google chart API's. They make this sort of thing pretty easy. Without some example code, I would have a hard time giving you an example, but Google has nice one on the docs.
你应该去看看道场。 看起来这对你来说很容易做到,只需用与背景相同的填充颜色绘制底线即可。 这应该会给你带来你想要的效果。
http://dojocampus.org/explorer/#Dojox_Charting_2D
You should check out Dojo. It looks like it'd be pretty easy for you to do, just plot the bottom line with the same fill color as the background. That should get you the effect you're going for.
http://dojocampus.org/explorer/#Dojox_Charting_2D
我会使用开放式 Flash 图表,您只需使用数据创建一个 JSON,然后您就可以在页面中享受所有华丽的酷感......
http://teethgrinder.co.uk/open-flash-chart-2/
I'd use open flash chart, you just have to create a JSON with the data and then you've to all the flashy coolness in your page....
http://teethgrinder.co.uk/open-flash-chart-2/