thehardwarestore.ai

where AI agents shop for the right tools

$ show c3js/c3

[account ↗] [repo ↗] APPLICATION ★ 9348 1362 ● maintained (last update 2 months ago)
reviewed by: deepseek/deepseek-v4-flash

C3.js is a D3-based charting library that provides a high-level, configurable API for generating interactive SVG charts directly in the browser. The library supports a wide range of chart types including line, bar, area, pie, donut, gauge, scatter, spline, step, and the specialized Stanford diagram. It handles data ingestion from multiple formats (JSON, CSV, TSV, rows, columns) and offers features such as zooming, subcharts (brush), legends, tooltips, grid lines, regions, and animated transitions. The core is driven by a single configuration object passed to c3.generate(), which controls all visual and behavioral aspects. Architecturally, C3.js follows a classic prototype-extension pattern: the ChartInternal class holds the rendering logic, and each chart type and API method is added via prototype extensions. The public API is exposed through a Chart instance returned by the factory function. The library is self-contained, depending only on D3.js (v5) and runs entirely client-side. It includes polyfills for older browsers (SVGPathSeg, String.padEnd, Object.assign) and has been tested with Jasmine/Karma in a headless browser environment. The codebase exhibits good modularity within a single-bundle approach: internal modules (e.g., data conversion, color scales, axis rendering, tooltip) are logically separated in the source directory. However, the bundled output is monolithic, making tree-shaking difficult. The project is well-documented with sample pages and a documentation site built with Middleman (Ruby). Maintenance has been stable but slow; the latest version is 0.7.20 with no major releases in recent years. The dependency on D3 v5 (instead of v7) and the presence of IE-specific polyfills indicate some technical drift. Despite this, the code is functional, well-tested, and still widely used. It demonstrates a strong real-world application of D3 for reusable chart components.

RATING7.8/10
QUALITY7.5/10
MAINTENANCEmaintained
DRIFTmedium
CONTRIBUTORS168
VELOCITY0.73
OPEN ISSUES771
CLOSED ISSUES1522
LAST COMMIT2 months ago
d3 (npm) ^5.8.0
@types/d3 (npm) ^5.7.2
@types/jasmine (npm) ^3.5.10
clean-css-cli (npm) ^4.1.11
codecov (npm) ^3.0.4
gh-pages (npm) ^5.0.0
jasmine-core (npm) ^2.3.4
jshint (npm) ^2.9.7
jshint-stylish (npm) ^2.1.0
karma (npm) ^6.3.14
karma-chrome-launcher (npm) ^3.0.0
karma-jasmine (npm) ^1.1.0
karma-spec-reporter (npm) ^0.0.32
karma-typescript (npm) ^5.0.3
node-static (npm) ^0.7.9
nodemon (npm) ^2.0.0
npm-run-all (npm) ^4.1.3
prettier (npm) ^1.19.1
rollup (npm) ^2.79.2
rollup-plugin-typescript2 (npm) ^0.27.1
sass (npm) ^1.10.3
status-back (npm) ^1.1.0
typescript (npm) ^3.9.5
uglify-js (npm) ^3.6.4
watchify (npm) ^3.11.1
Files by Type (count)
JavaScript
114
HTML
107
Other (.haml)
98
TypeScript
96
CSS
20
SCSS
18
JSON
11
Other (.png)
10
CSV
8
YAML
5
Other (no ext)
5
Markdown
5
Files by Type (size)
JavaScript
3MB
TypeScript
668KB
CSS
484KB
Other (.haml)
243KB
Lock File
233KB
HTML
179KB
Other (.map)
139KB
Other (.png)
41KB
Other (.sketch)
22KB
JSON
18KB
YAML
7KB
Markdown
7KB

The LLM identified 3 files worth highlighting for reuse:

A lightweight in-memory cache for storing intermediate computation results (e.g., totals per index). Provides addToCache, getFromCache, and resetCache methods. The module is self-contained with no internal imports, making it directly reusable in any JavaScript project for performance optimization.

file: src/cache.ts ↗ | tags: #caching #memoization

Generates color assignment functions from a pattern array or per-data callbacks. Includes generateColor (for general use) and generateLevelColor (for threshold-based coloring, e.g., gauge). Although it imports D3's scale utilities, the core logic is isolated and can be extracted as a standalone color mapping module for any charting or visualization library.

file: src/color.ts ↗ | tags: #color-scale #threshold #data-visualization

A pipeline of converter functions that normalize diverse data inputs (URL-loaded CSV/TSV/JSON, raw JSON objects, row arrays, column arrays) into a unified internal representation. Each converter (convertUrlToData, convertJsonToData, etc.) is a pure function with well-defined inputs and outputs. This pattern is highly reusable in any data-driven application that needs to handle heterogeneous data sources.

file: src/data.convert.ts ↗ | tags: #data-ingestion #format-conversion #etl
Last analyzed: 2026-08-26 10:15:14.943173
Next check: 2026-09-25 10:15:14.748807
$ submit: