Flot - 柱形图,系列对齐在一起
我可以绘制这样的图表 http://developer.yahoo.com/ yui/examples/charts/charts-rotation.html 使用 flot ?
我的意思是,我有两个在 x 轴上具有相同值的系列,我想将它们显示为对齐在一起,如上面的示例所示,Flot 将它们绘制在另一个之上。
有什么想法吗?
Can I plot charts like this http://developer.yahoo.com/yui/examples/charts/charts-rotation.html using flot ?
I mean, I have two series with the same values on the x axis, I want to show them aligned together like in the example above, Flot plots them one above the another.
Any ideas ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,这有点晚了,但你可以这样做...Flot 不支持开箱即用,但有一个非常好的补丁和插件可以让它做你想做的事。
您可以从 Flot Issue #159 获取它们。您需要修补您的flot(根据您使用的版本,该问题中有一些副本)。由于使用了较新的版本,我的补丁被拒绝了一两次...然后在 flot 之后将 multi 插件添加到您的 javascript 源中。最后,在实际的
plot
调用选项中使用multiplebars:true
。一旦您准备好正确的脚本,它就会是什么样子:
您可以在这里看到它的实际效果:http://jsfiddle.net/ryleyb/B3uGP/2/
编辑:请注意,自从我做出这个答案以来,flot 已转移到 github。在那里,有人提出了一个拉取请求,其中包含可以更好应用的多插件到代码的当前版本。
Well this is a bit late, but here's how you do it... Flot does not support this out of the box, but there's a perfectly good patch and plugin that will get it doing what you want.
You get them from Flot Issue #159. You'll need to patch your flot (depending on what revision you're using, there's a few copies in the issue). I had a reject or two from the patch due to using a newer revision... Then add the multi plugin to your javascript sources after flot. Finally, use
multiplebars:true
in your actualplot
call's options.Here's the general idea of what it will look like once you have the right scripts ready to go:
You can see it in action here: http://jsfiddle.net/ryleyb/B3uGP/2/
EDIT: Note that since I made this answer, flot has moved over to github. Over there, someone has made a pull request that includes the multi plugin which will apply better to current versions of the code.