Skip to content
CAI
Software that uses CAICheck a score

topfunky/gruff

67.5

Adequate · 19 September 2026

5.1k

lines of production code

Ruby

primary language

1

measurement over time

CAI band scale
CAI lens gauges

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 watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 67.

Lenses

  • Code Health 95
  • Architecture 100
  • Maturity 57
  • Readiness 67
  • Security 76

Changes since last survey

  • 300 commits — 233 feature/other, 67 fixes

By area

  • lib/gruff — 122 commits
  • (root) — 96 commits
  • test/expected — 44 commits
  • .github/workflows — 23 commits
  • sig/generated — 2 commits
  • test/gruff_test_case.rb — 2 commits
  • test/test_accumulator_bar.rb — 2 commits
  • test/test_area.rb — 2 commits
  • test/test_box.rb — 2 commits
  • (repo) — 1 commit
  • .devcontainer/devcontainer.json — 1 commit
  • .github/ISSUE_TEMPLATE — 1 commit
  • .github/dependabot.yml — 1 commit
  • test/test_line.rb — 1 commit

Notable commits

  • fix: Accept image format in Base#to_image in order to fix no decode delegate for this image format error (#619)
  • fix: CI: Fix version of r7kamura/rubocop-problem-matchers-action
  • fix: Candlestick: Fix graph width calculation (#671)
  • fix: ChangeLog: Fix style
  • fix: Dev: Fix setting of .editorconfig (#639)
  • fix: Docker: Fix legacy ENV format
  • fix: Fix Gruff::AccumulatorBar raises exception if data contains nil (#654)
  • fix: Fix Gruff::Area raises exception if data contains nil (#653)
  • fix: Fix Gruff::Bar and Gruff::SideBar in order to draw positive and negative mixed graph (#620)
  • fix: Fix Gruff::Bezier raises exception if data contains nil (#660)
  • fix: Fix Gruff::Box raises exception if data contains nil (#648)
  • fix: Fix Gruff::Candlestick raises exception if data contains nil (#655)
  • fix: Fix Gruff::Dot raises exception if data contains nil (#656)
  • fix: Fix Gruff::Histogram raises exception if data contains nil (#657)
  • fix: Fix Gruff::Line to prevent unknown lines drawing (#664)
  • fix: Fix Gruff::Net raises exception if data contains nil (#658)
  • fix: Fix Gruff::Pie raises exception if data contains nil (#659)
  • fix: Fix Gruff::SideStackedBar raises exception if data contains nil (#647)
  • fix: Fix Gruff::StackedArea raises exception if data contains nil (#652)
  • fix: Fix Gruff::StackedBar raises exception if data contains nil (#646)
  • …and 280 more

Written by watchdog.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 19 September 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.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-b51f968c9b10.