Skip to content

Conversation

@nkyllonen
Copy link
Collaborator

@nkyllonen nkyllonen commented Jan 16, 2026

Overview

Refactors axis labels and grid lines from opinionated core components into optional helper modules (Plox.Helpers.Axis and Plox.Helpers.Grid), while adding utility functions to the main Plox module for positioning elements relative to graph boundaries, encouraging users to drop down to raw SVG <text> and <line> elements for more control.

Technical Details

  • Adds Plox.Helpers.Axis module
    • x_labels: component for rendering labels for a given Plox.XAxis
    • y_labels: component for rendering labels for a given Plox.YAxis
  • Adds Plox.Helpers.Grid module
    • vertical_lines: component for rendering vertical lines from the top of the graph area to the bottom
    • horizontal_lines: component for rendering horizontal lines from the left of the graph area to the right
  • Adds Plox.Constants module: svg_presentation_attrs/0 and default_label_gap/0
  • Removes old Plox components and code
    • @svg_presentation_globals module attribute
    • x_axis_labels and x_axis_label components
    • y_axis_labels and y_axis_label components
    • x_axis_grid_lines and x_axis_grid_line components
    • y_axis_grid_lines and y_axis_grid_line components
  • Adds Plox utility functions
    • scale_values/2
    • above_graph/2
    • below_graph/2
    • left_of_graph/2
    • right_of_graph/2
    • graph_top/2
    • graph_bottom/2
    • graph_left/2
    • graph_right/2
  • Updates DemoLive and AnimatedDemoLive with new components
  • Updates README and migration_guide examples
  • Adds tests for new Plox utility functions

@nkyllonen nkyllonen changed the title Refactor/axis labels and grid lines Axis and Grid Helpers Jan 20, 2026
@nkyllonen nkyllonen force-pushed the refactor/axis-labels-and-grid-lines branch from 2aceb5b to 38f4b03 Compare January 21, 2026 17:40
@nkyllonen nkyllonen force-pushed the refactor/axis-labels-and-grid-lines branch from a5c5473 to 5ecdd91 Compare January 22, 2026 19:53
@nkyllonen nkyllonen requested a review from Copilot January 22, 2026 19:55
@nkyllonen nkyllonen self-assigned this Jan 22, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors axis labels and grid lines from opinionated core components in the main Plox module into optional helper modules (Plox.Helpers.Axis and Plox.Helpers.Grid). It also introduces utility functions in the Plox module for positioning elements relative to graph boundaries and creates a new Plox.Constants module for shared constants.

Changes:

  • Removed old axis label and grid line components from the main Plox module
  • Added new Plox.Helpers.Axis and Plox.Helpers.Grid modules with refactored components
  • Added utility functions (scale_values, above_graph, below_graph, left_of_graph, right_of_graph, graph_top, graph_bottom, graph_left, graph_right) to the main Plox module
  • Created Plox.Constants module for SVG presentation attributes and default label gap
  • Updated all examples and documentation to use the new helper modules

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/plox/helpers/axis.ex New module containing x_labels and y_labels components for rendering axis labels
lib/plox/helpers/grid.ex New module containing vertical_lines and horizontal_lines components for rendering grid lines
lib/plox/constants.ex New module defining SVG presentation attributes and default label gap constant
lib/plox.ex Removed old component functions, added new utility functions for positioning, updated to use Constants module
mix.exs Added "Helpers" documentation group for the new helper modules
examples/demo_live.exs Updated to use new helper modules with aliased names
examples/animated_demo_live.exs Updated to use new helper modules and raw SVG elements
docs/migration_guide.md Updated examples to show correct usage of new helper modules
README.md Updated examples to demonstrate new helper module usage
.gitignore Added .DS_Store to ignored files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@nkyllonen nkyllonen marked this pull request as ready for review January 22, 2026 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant