Apache ECharts — Powerful Interactive Charting Library
Apache ECharts is a powerful, interactive charting and data visualization library for browsers. 40+ chart types, canvas/SVG rendering, streaming data, and GPU acceleration. The enterprise choice used by Alibaba, Baidu, and countless dashboards.
Instalación lista para agent
Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.
npx -y tokrepo@latest install b3e552ed-3588-11f1-9bc6-00163e2b0d79 --target codexEjecutar después de confirmar el plan con dry-run.
What it is
Apache ECharts is an open-source JavaScript charting library maintained by the Apache Software Foundation. It supports over 40 chart types including line, bar, scatter, pie, radar, treemap, sankey, and geographic maps. The library renders via both Canvas and SVG, handles large datasets with incremental rendering, and supports real-time streaming data.
ECharts targets frontend developers who need rich, interactive data visualizations in web applications. It works in any JavaScript environment -- vanilla JS, React, Vue, Angular -- and supports server-side rendering for static chart generation.
How it saves time or tokens
ECharts uses a declarative options object to define charts. Instead of writing imperative drawing code, you describe what the chart should look like as a JSON-like configuration, and ECharts handles the rendering, animations, tooltips, and interactions. This approach reduces the amount of code needed for complex visualizations.
The library includes built-in responsive sizing, data zoom controls, and export-to-image functionality. These features would take significant development time to build from scratch with lower-level libraries like D3.js.
How to use
- Install ECharts:
npm install echarts
- Initialize a chart and set options:
import * as echarts from 'echarts';
const chart = echarts.init(document.getElementById('main'));
chart.setOption({
title: { text: 'Weekly Sales' },
tooltip: { trigger: 'axis' },
xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'] },
yAxis: { type: 'value' },
series: [{ data: [120, 200, 150, 80, 70], type: 'bar' }]
});
- The chart renders automatically with animations, tooltips, and responsive behavior.
Example
import * as echarts from 'echarts';
const chart = echarts.init(document.getElementById('chart'));
chart.setOption({
tooltip: { trigger: 'item' },
legend: { top: '5%', left: 'center' },
series: [{
name: 'Traffic Sources',
type: 'pie',
radius: ['40%', '70%'],
avoidLabelOverlap: false,
itemStyle: { borderRadius: 10, borderColor: '#fff', borderWidth: 2 },
label: { show: false, position: 'center' },
emphasis: { label: { show: true, fontSize: 24, fontWeight: 'bold' } },
data: [
{ value: 1048, name: 'Search' },
{ value: 735, name: 'Direct' },
{ value: 580, name: 'Email' },
{ value: 484, name: 'Social' },
{ value: 300, name: 'Referral' }
]
}]
});
This creates a donut chart with hover emphasis effects, a legend, and tooltips -- all from a single options object.
Related on TokRepo
- AI design tools -- Explore visualization and design tools for data presentation
- Featured workflows -- Discover other popular tools and libraries on TokRepo
Common pitfalls
- ECharts requires a DOM element with explicit width and height. If the container has zero dimensions when
initis called, the chart will not render. Set CSS dimensions on the container before initialization. - Importing the full ECharts bundle adds significant bundle size. Use tree-shaking imports (
import { BarChart } from 'echarts/charts') to include only the chart types and components you need. - Resizing the browser window does not automatically resize charts. Call
chart.resize()in a window resize event listener or use ResizeObserver for container-level resizing.
Preguntas frecuentes
ECharts is a higher-level, declarative charting library. You define what the chart looks like via a configuration object. D3.js is a lower-level library that gives you fine-grained control over SVG/Canvas elements. ECharts is faster for standard chart types; D3 is more flexible for custom or unusual visualizations.
Yes. ECharts supports incremental rendering and data sampling for large datasets. It can render hundreds of thousands of data points using progressive rendering, where the chart builds up over multiple animation frames. The dataset component supports data transforms like filtering and sorting.
Yes. ECharts works with any frontend framework. The community maintains wrapper libraries like echarts-for-react and vue-echarts that provide component-level integration with lifecycle management. You can also use the core library directly in any framework.
Yes. ECharts provides a server-side rendering mode using node-canvas or the SVG renderer. This lets you generate chart images (PNG, SVG) in Node.js for use in emails, PDFs, or static pages without a browser.
Yes. Apache ECharts is released under the Apache 2.0 license, which permits commercial use, modification, and distribution without royalty fees. The Apache Software Foundation maintains the project.
Referencias (3)
- Apache ECharts— Apache ECharts is an open-source charting library
- ECharts GitHub— 40+ chart types with Canvas and SVG rendering
- Apache License— Apache 2.0 license
Relacionados en TokRepo
Discusión
Activos relacionados
Fabric.js — Powerful HTML5 Canvas Library for Interactive Graphics
A feature-rich JavaScript library that provides an interactive object model on top of the HTML5 canvas element, enabling drawing, manipulation, and animation of shapes, images, and text.
Apache Superset — Open Source Data Visualization & Exploration
Apache Superset is a modern data exploration and visualization platform. Connect any SQL database, build interactive dashboards with 40+ chart types, no coding required.
Apache Zeppelin — Web-Based Notebook for Interactive Data Analytics
Apache Zeppelin is a web-based notebook that supports multiple language backends including Spark, SQL, Python, and Scala, enabling interactive data exploration, visualization, and collaboration.
Apache NiFi — Visual Dataflow Automation & Integration Platform
Apache NiFi is a powerful dataflow management system that lets you design, control, and monitor data pipelines through a drag-and-drop web interface. Built for enterprise data routing, transformation, and system mediation with provenance tracking and guaranteed delivery.