$ show AnyChart/GraphicsJS
GraphicsJS is a lightweight 2D vector graphics library that serves as the core rendering engine for AnyChart charting products. It provides a cross-browser abstraction layer over SVG (modern browsers) and VML (legacy Internet Explorer), offering a chainable API for drawing shapes, paths, text, images, and applying fills, gradients, and transformations. The library includes an event system, drag-and-drop support, and export capabilities to PNG, JPG, PDF, and SVG via an external server. Its architecture follows a clean renderer pattern with abstract base classes and concrete SVG/VML implementations, along with a dirty-state rendering mechanism for efficient updates. However, the codebase is heavily dependent on the deprecated Google Closure Library, includes substantial VML support for obsolete browsers, and lacks modern module systems or tests, resulting in significant technical drift. It is functionally complete and has been used in production, but is not recommended for new projects without substantial modernization.
The LLM identified 2 files worth highlighting for reuse:
A deterministic finite automaton (DFA)-based HTML tokenizer that parses HTML text into tokens (tags, text, comments, etc.). It is self-contained, has no internal dependencies on the rest of the library, and can be extracted and reused in any JavaScript project requiring HTML parsing without a DOM. The implementation is efficient and handles edge cases like self-closing tags and attributes.
A collection of mathematical utilities for vector graphics, including BΓ©zier curve calculations (cubic and quadratic), matrix transformations (translate, rotate, scale, skew), and rectangle geometry operations. While it depends on Google Closure's goog.math and goog.array, the core functions are pure and could be extracted with minimal adaptation for use in other graphics or geometry libraries.