有没有人会推荐一个特别的JavaScript图表库——特别是一个根本不使用flash的库?
当前回答
看看谷歌可视化API,这是一种更简单的图表API的推广
其他回答
一个框架:http://www.simile-widgets.org/
一个基本的:http://www.filamentgroup.com/examples/charting_v2/index_2.php
好看:http://www.highcharts.com/
Flotr是另一个基于Prototype的纯Javascript图表库,灵感来自Flot
我最近正在寻找一个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。复杂/不同,时间不紧迫,那就和拉斐尔和朋友们一起去吧。
我可以推荐arcadicharts。一个全新的专业的JavaScript和GWT图表库。在没有插件的所有浏览器中运行。简单和快速使用:创建伟大的外观图表,只需几行代码。 免费用于非商业用途。
有越来越多的纯JavaScript图表的开源和商业解决方案不需要Flash。在这个回答中,我将只介绍开源选项。
对于不需要Flash的图像,有两类主要的JavaScript解决方案:
基于画布的,在IE中使用ExplorerCanvas渲染,这反过来依赖于VML 基于标准的浏览器上的SVG,在IE中呈现为VML
这两种方法各有利弊,但对于图表库,我推荐后者,因为它与DOM集成得很好,允许使用DOM操作图表元素,最重要的是设置DOM事件。相比之下,Canvas图表库必须重新发明DOM轮来管理事件。因此,除非您打算构建没有事件处理的静态图形,否则SVG/VML解决方案应该更好。
对于SVG/VML解决方案,有许多选项,包括:
Dojox图表,如果您已经使用了Dojo工具包,那就很好 Raphael-based解决方案
Raphael是一个非常活跃,维护良好,成熟的开源图形库,具有非常好的跨浏览器支持,包括IE 6到8,Firefox, Opera, Safari, Chrome和Konqueror。Raphael不依赖于任何JavaScript框架,因此可以使用Prototype, jQuery, Dojo, Mootools等…
有许多基于拉斐尔的图表库,包括(但不限于):
gRaphael, Raphael图形库的扩展 Ico,具有基于单个函数调用的直观API来创建复杂的图表
披露:我是github上Ico分支之一的开发者。