问题描述
有人会推荐一个特定的 JavaScript 图表库 - 特别是一个根本不使用 Flash 的库吗?
Would anyone recommend a particular JavaScript charting library - specifically one that doesn't use flash at all?
推荐答案
越来越多的不需要 Flash 的纯 JavaScript 图表的开源和商业解决方案.在此回复中,我将仅介绍开源选项.
There is a growing number of Open Source and commercial solutions for pure JavaScript charting that do not require Flash. In this response I will only present Open Source options.
对于不需要 Flash 的图形,有 2 类主要的 JavaScript 解决方案:
There are 2 main classes of JavaScript solutions for graphics that do not require Flash:
- 基于画布,使用 ExplorerCanvas 在 IE 中呈现,而后者又依赖于 VML
- 基于标准的浏览器上的 SVG,在 IE 中呈现为 VML
两种方法各有利弊,但对于图表库,我会推荐后者,因为它与 DOM 很好地集成,允许使用 DOM 操作图表元素,最重要的是设置 DOM 事件.相比之下,Canvas 图表库必须重新发明 DOM 轮来管理事件.因此,除非您打算构建没有事件处理的静态图,否则 SVG/VML 解决方案应该更好.
There are pros and cons of both approaches but for a charting library I would recommend the later because it is well integrated with DOM, allowing to manipulate charts elements with the DOM, and most importantly setting DOM events. By contrast Canvas charting libraries must reinvent the DOM wheel to manage events. So unless you intend to build static graphs with no event handling, SVG/VML solutions should be better.
对于 SVG/VML 解决方案,有很多选择,包括:
For SVG/VML solutions there are many options, including:
- Dojox Charting, good if you use the Dojo toolkit already
- Raphael-based solutions
Raphael 是一个非常活跃、维护良好且成熟的开源图形库,具有非常好的跨浏览器支持包括 IE 6 到 8、Firefox、Opera、Safari、Chrome 和 Konqueror.Raphael 不依赖于任何 JavaScript 框架,因此可以与 Prototype、jQuery、Dojo、Mootools 等一起使用...
Raphael is a very active, well maintained, and mature, open-source graphic library with very good cross-browser support including IE 6 to 8, Firefox, Opera, Safari, Chrome, and Konqueror. Raphael does not depend on any JavaScript framework and therefore can be used with Prototype, jQuery, Dojo, Mootools, etc...
有许多基于 Raphael 的图表库,包括(但不限于):
There are a number of charting libraries based on Raphael, including (but not limited to):
- gRaphael, an extension of the Raphael graphic library
- Ico, with an intuitive API based on a single function call to create complex charts
披露:我是 github 上的一个 Ico 分支 的开发者.
Disclosure: I am the developer of one of the Ico forks on github.
这篇关于JavaScript 图表库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!