有没有人会推荐一个特别的JavaScript图表库——特别是一个根本不使用flash的库?
当前回答
我最近正在寻找一个javascript图表库,我评估了一大堆,最后确定了jqplot,它非常符合我的要求。正如Jean Vincent的回答所提到的,你需要在基于canvas和基于svg的解决方案之间做出选择。
To my mind the major pros and cons were as follows. The SVG based solutions like Raphael (and offshoots) are great if you want to construct highly dynamic/interactive charts. Or if you charting requirements are very much outside the norm (e.g. you want to create some sort of hybrid chart or you've come up with a new visualization that no-one else has thought of yet). The downside is the learning curve and the amount of code you will have to write. You won't be banging out charts in a few minutes, be prepared to invest some real learning time and then to write a goodly amount of code to produce a relatively simple chart.
If your charting requirements are reasonably standard, e.g. you want some line or bar graphs or perhaps a pie chart or two, with limited interactivity, then it is worth looking at canvas based solutions. There will be hardly any learning curve, you'll be able to get basic charts going within a few minutes, you won't need to write a lot of code, a few lines of basic javascript/jquery will be all you need. Of course you will only be able to produce the specific types of charts that the library supports, usually limited to various flavors of line, bar, pie. The interactivity choices will be extremely limited, that is to say non-existent for many of the libraries out there, although some limited hover effects are possible with the better ones.
我使用了JQplot,这是一个基于画布的解决方案,因为我只需要一些标准类型的图表。从我的研究和各种选择中,我发现它的功能相当全面(如果你只追求标准图表),而且非常容易使用,所以如果你的要求相似,我会推荐它。
总而言之,简单且需要图表,然后使用JQplot。复杂/不同,时间不紧迫,那就和拉斐尔和朋友们一起去吧。
其他回答
可能不是OP所寻找的,但由于这个问题已经成为JS图表库选项列表:jQuery Sparklines真的很酷。
如果你正在使用jQuery,我发现flot非常好-尝试一下示例,看看它们是否适合你的需求,但我发现它们可以满足我当前项目的大部分需求。
此外,ExtJS 4.0还引入了一组非常强大的图表,旨在处理实时数据。
Fusion charts有一个新的javascript/jquery库,看起来很有前途。
也许这不是你想要的,但是 谷歌的图表API非常酷,很容易使用。
还有另一个基于SVG的javascript库。它被称为Protovis,来自斯坦福可视化小组
它还允许制作漂亮的交互式图形和可视化。
http://vis.stanford.edu/protovis/ex/
尽管它只适用于现代网络浏览器
更新:protovis团队已经迁移到另一个名为d3.js(数据驱动文档)的库,正如他们所说:
Protovis团队现在正在开发一个新的可视化库D3.js,改进了对动画和交互的支持。D3建立在Protovis的许多概念之上。”
新库现在可以在以下地址找到:
http://mbostock.github.com/d3/
更新2:
“Rickshaw”是一个用于创建交互式时间序列图的JavaScript工具包。基于d3.js,这大大简化了d3.js的工作,尽管功能有点不强大。
http://code.shutterstock.com/rickshaw/
推荐文章
- Javascript和regex:分割字符串并保留分隔符
- 如何检查DST(日光节约时间)是否有效,如果是,偏移量?
- 如何打破_。在underscore.js中的每个函数
- 如何在jQuery中获得当前日期?
- 如何创建一个日期对象从字符串在javascript
- 输入触发器按钮单击
- 获取对象的属性名
- 如何检查用户是否可以回到浏览器历史
- 相当于字符串。jQuery格式
- 如何在vue-cli项目中更改端口号
- Angular 2模板中的标签是什么意思?
- JavaScript .includes()方法的多个条件
- 窗口。亲近与自我。close不关闭Chrome中的窗口
- 同步和异步编程(在node.js中)的区别是什么?
- 在d3.js中调整窗口大小时调整svg的大小