英Welcome to Chart.js!
- 开始使用 Chart.js — 如果你是 Chart.js 的新手，则最好
- 从 Chart.js v3 或 Chart.js v2 迁移
- 在 Discord (opens new window) 和 推特 (opens new window) 上加入社区
- 在 Stack Overflow (opens new window) 上发布带有
- 为 Chart.js 做贡献
# 为什么选择 Chart.js
英Chart.js was created and announced (opens new window) in 2013 but has come a long way since then. It’s open-source, licensed under the very permissive MIT license (opens new window), and maintained by an active community.
英Chart.js provides a set of frequently used chart types, plugins, and customization options. In addition to a reasonable set of built-in chart types, you can use additional community-maintained chart types (opens new window). On top of that, it’s possible to combine several chart types into a mixed chart (essentially, blending multiple chart types into one on the same canvas).
Chart.js 可通过 自定义插件 (opens new window) 高度自定义，以创建注释、缩放或拖放功能等等。
英Chart.js is highly customizable with custom plugins (opens new window) to create annotations, zoom, or drag-and-drop functionalities to name a few things.
Chart.js 带有一个合理的默认配置，使得开始使用和获得可用于生产的应用变得非常容易。 即使你根本不指定任何选项，你也有可能获得非常吸引人的图表。 例如，Chart.js 默认启用动画，因此你可以立即将注意力吸引到你使用数据讲述的故事上。
英Chart.js comes with a sound default configuration, making it very easy to start with and get an app that is ready for production. Chances are you will get a very appealing chart even if you don’t specify any options at all. For instance, Chart.js has animations turned on by default, so you can instantly bring attention to the story you’re telling with the data.
英Chart.js has very thorough documentation (yes, you're reading it), API reference, and examples. Maintainers and community members eagerly engage in conversations on Discord (opens new window), GitHub Discussions (opens new window), and Stack Overflow (opens new window) where more than 11,000 questions are tagged with
Chart.js 在 HTML5 画布上渲染图表元素，与其他几个（主要是基于 D3.js 的、渲染为 SVG 的图表库）不同。 Canvas 渲染使 Chart.js 非常高效，特别是对于大型数据集和复杂的可视化，否则需要 DOM 树中的数千个 SVG 节点。 同时，canvas 渲染不允许使用 CSS 样式，因此你必须为此使用内置选项，或者创建自定义插件或图表类型来根据你的喜好渲染所有内容。
英Chart.js renders chart elements on an HTML5 canvas unlike several others, mostly D3.js-based, charting libraries that render as SVG. Canvas rendering makes Chart.js very performant, especially for large datasets and complex visualizations that would otherwise require thousands of SVG nodes in the DOM tree. At the same time, canvas rendering disallows CSS styling, so you will have to use built-in options for that, or create a custom plugin or chart type to render everything to your liking.
英Chart.js is very well suited for large datasets. Such datasets can be efficiently ingested using the internal format, so you can skip data parsing and normalization. Alternatively, data decimation can be configured to sample the dataset and reduce its size before rendering.
最后，与 SVG 渲染相比，Chart.js 使用的画布渲染减少了 DOM 树的负担。 此外，tree-shaking 支持允许你在包中包含最少的 Chart.js 代码部分，从而减少包大小和页面加载时间。
英In the end, the canvas rendering that Chart.js uses reduces the toll on your DOM tree in comparison to SVG rendering. Also, tree-shaking support allows you to include minimal parts of Chart.js code in your bundle, reducing bundle size and page load time.
英Chart.js is actively developed (opens new window) and maintained by the community. With minor releases (opens new window) on an approximately bi-monthly basis and major releases with breaking changes every couple of years, Chart.js keeps the balance between adding new features and making it a hassle to keep up with them.