topfunky/gruff
63.4
Adequate · 6 November 2026
5.1k
lines of production code
Ruby
primary language
4
measurements over time
What this system is
This system is a Ruby library for generating various data visualization charts, including bar, line, pie, and specialized financial or statistical plots like candlestick and box charts. It provides a refactored rendering engine that supports lazy loading, type safety via RBS signatures, and integration with Rails through scaffolding generators. The library handles the creation of static image outputs, such as PNGs, with configurable styling and layout options for both standard and mini graph formats.
How it got here
2008 — Modernization and new chart types
8 changes.
The project underwent a significant modernization, upgrading to Ruby 3.0, replacing the build system with Bundler and Rake, and introducing lazy autoloading to improve performance. This period also saw the addition of several new chart types, such as Bezier and Candlestick, alongside a refactored rendering engine and expanded test coverage using Minitest.
2020–2025 — RBS typing and rendering refactoring
6 changes.
This period focused on introducing comprehensive RBS type signatures to enhance static analysis and IDE support while refactoring the internal architecture for better maintainability. The codebase was restructured by replacing monolithic logic with dedicated classes for data storage, bar chart helpers, and graph rendering shapes, all without altering the public API. Additionally, visual regression testing capabilities were added to improve test reliability.
Features
Add RBS type signatures for Gruff graphing library
This change introduces a comprehensive set of RBS (Ruby Signature) type definition files for the Gruff graphing library. The new signatures cover the core \Gruff::Base\ class, all specific graph types (such as Bar, Line, Pie, Candlestick, and Area), helper modules, and internal rendering components. This provides static type checking and improved IDE autocompletion for developers using the library.
sig · high confidence
Added Gruff chart generator for Rails
A new Rails generator has been added that scaffolds a controller, functional test, and views for generating line charts using the Gruff library. Running the generator creates a controller with a sample 'show' action that renders a PNG line chart with sample data, along with a corresponding functional test to verify the response.
_rails\generators · high confidence
New chart types and refactored rendering engine
Gruff now includes several new graph types: Bezier (smooth curves), Box (box plots with quartiles and outliers), Bubble (scatter plots with variable point sizes), Candlestick (financial OHLC charts), Dot (vertical dot plots), and Histogram (frequency distributions). The library has also been refactored to use a new \Gruff::Renderer\ module for drawing primitives, replacing the previous direct RMagick calls, and introduces a \Gruff::Font\ class for font management. Additionally, the \Gruff::BoxPlot\ class has been renamed to \Gruff::Box\, and legacy classes like \PhotoBar\ and \Scene\ have been removed.
lib/gruff · high confidence
Removals
Removal of legacy Gruff graphing assets and scripts
The artwork directory no longer includes the Gruff graphing integration, specifically deleting the \gruff\_controller.rb\ and \gruffs\_helper.rb\ files that previously handled graph rendering and embedding. Additionally, the \install\_rmagick.sh\ setup script and associated Keynote backup files have been removed, cleaning up obsolete dependencies and temporary assets from the project.
artwork · high confidence
Architecture
Project build system and development tooling overhaul
The project has migrated from the Hoe gem to standard Bundler and Rake tasks, removing the legacy Rakefile, Manifest.txt, and README.txt files. A new Dockerfile and helper scripts (docker-build.sh, docker-launch.sh, before\_install\_linux.sh) have been added to standardize the development environment, including building ImageMagick 7.1.2-22 from source. RuboCop configuration has been modernized with a new .rubocop.yml and .rubocop\_todo.yml, targeting Ruby 3.0 and integrating plugins like rubocop-minitest and rubocop-rbs\_inline. Additionally, RBS type signatures are now supported via a Steepfile and rake tasks, and the changelog has been converted to Markdown (CHANGELOG.md).
(repo-wide) · high confidence
Behavioural changes
Mini graphs now support right-aligned legends and configurable visibility
The Gruff::Mini graph classes (Bar, Pie, SideBar) have been refactored to allow legends to be hidden or rendered on the right-hand side of the graph, in addition to the default bottom position. Users can now control legend visibility via the \hide\_mini\_legend\ attribute and choose the layout using the \legend\_position\ attribute (e.g., \:right\). This change also updates the default legend font size to 50.0 and improves label truncation to prevent overflow, ensuring mini graphs remain readable at small sizes.
lib/gruff/mini · high confidence
Refactored bar chart rendering logic into dedicated helper modules
The internal rendering logic for bar charts has been reorganized into new helper modules: \BarConversion\ handles Y-axis coordinate calculations for positive, negative, and mixed-value bars; \BarMixin\ and \StackedMixin\ manage data normalization and grouping for standard and stacked bars respectively; and \BarValueLabel\ centralizes the formatting and positioning of value labels. This refactoring extracts these responsibilities from the main chart classes to improve code maintainability and type safety via RBS signatures, without changing the external API or visual output for users.
lib/gruff/helper · high confidence
Refactored data storage into dedicated Store and data structure classes
The internal data handling in lib/gruff/store has been restructured to use explicit classes instead of Ruby Structs. A new Store class now manages collections of data points, while specific data structures—BasicData for simple series, XYData for X/Y coordinates, and XYPointsizeData for bubble charts with point sizes—encapsulate the data and their normalization logic. This change unifies the interface for adding and normalizing data across different chart types, improving type safety and maintainability without altering the public API.
lib/gruff/store · high confidence
Refactored graph rendering into dedicated shape classes
The rendering logic in lib/gruff/renderer has been restructured from a monolithic approach into a set of specialized classes (Bezier, Circle, DashLine, Dot, Ellipse, Line, Polygon, Polyline, Rectangle, Text) that encapsulate the drawing of individual graph elements. This change introduces a push/pop state management pattern to isolate drawing settings like stroke width, color, and opacity for each shape, ensuring that rendering one element does not inadvertently affect others. The main Renderer class now coordinates these components and handles background generation (solid, gradient, image, or transparent), while text rendering is deferred to a queue to ensure it appears on top of other graph elements.
lib/gruff/renderer · high confidence
Refactored library loading to use lazy autoloads and explicit dependencies
The main library entry point has been rewritten to replace the previous eager \require\ loop with explicit \autoload\ declarations for all chart types (such as Bar, Line, Pie, and new additions like Bezier, Bubble, and Candlestick) and renderer components. This change, combined with the addition of \require\_relative\ calls for core dependencies like RMagick and internal patches, implements lazy loading to reduce initial memory usage and improves code organization by clearly defining the module structure and dependencies.
lib · high confidence
Refined monkey patches for String and RMagick with RBS signatures
The library now uses Ruby refinements to apply monkey patches, isolating changes to the String and RMagick Draw classes. A new \commify\ method is added to String for formatting numbers, and an \annotate\_scaled\ method is added to RMagick's Draw class to support scaled text annotations. These patches are now accompanied by RBS type signatures for better static analysis support.
lib/gruff/patch · high confidence
Test coverage
Added visual regression test helper for image comparison; Expanded test coverage for chart types and test infrastructure.
Dependencies
Update Ruby requirements and core dependencies
The gem now requires Ruby 3.0.0 or newer, dropping support for older versions. Core runtime dependencies have been updated: RMagick is pinned to version 5.5 or later (with RMagick4J for JRuby), and BigDecimal is required at version 3.0 or later. Development tooling has also been refreshed, with Rubocop updated to version 1.66 and its associated linters (minitest, performance, rake, rbs\_inline) aligned to recent stable releases.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 64 → 63 (-0.6)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.
Lenses
- Code Health 74 → 74 (+0.0)
- Architecture 100 → 100 (+0.0)
- Maturity 52 → 53 (+0.3)
- Readiness 69 → 69 (+0.0)
- Security 80 → 72 (-8.1)
Resolved (6)
- Documentation: no architecture or design documentation
- Inconsistent API style for setting themes. There is a generic setter theme=(options) alongside multiple specific methods for predefined themes. This forces users to learn two different ways to apply a theme (one generic, one specific) when the specific ones could likely be implemented as wrappers around the generic one.
- Inconsistent accessor patterns. minimum_value and maximum_value are exposed as both Properties (likely getters) and Methods (likely getters or setters). In Ruby, this usually implies a getter method and a property accessor, but having both explicitly listed as distinct members with the same name creates ambiguity about whether one is a setter or if they are duplicates.
- Inconsistent naming and scope for background transparency. Base uses a setter property pattern transparent_background=, while Renderer uses a method transparent_background that also takes dimensions. The intent (making background transparent) is similar, but the API surface differs significantly in signature and naming convention (setter vs method).
- Off-boarding risk: anonymized user #1
- Redundant methods with overlapping intent. Both methods appear to perform normalization on the store's data. norm_data takes no arguments, while normalize takes keywords, suggesting one might be a convenience wrapper or they handle different normalization scopes, but the naming convention is inconsistent (abbreviated vs full word).
New (1)
- Off-boarding risk: anonymized user #1
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
topfunky/gruff was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 6 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 41ed5105f1b8ba6c16719766a7b91cb2cba41e9d — the exact code this score is about.
- Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.2+preprod-5c4e66d9318b.