Open
Conversation
nkyllonen
commented
Jan 16, 2026
2aceb5b to
38f4b03
Compare
a5c5473 to
5ecdd91
Compare
There was a problem hiding this comment.
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
Ploxmodule - Added new
Plox.Helpers.AxisandPlox.Helpers.Gridmodules 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 mainPloxmodule - Created
Plox.Constantsmodule 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Refactors axis labels and grid lines from opinionated core components into optional helper modules (
Plox.Helpers.AxisandPlox.Helpers.Grid), while adding utility functions to the mainPloxmodule for positioning elements relative to graph boundaries, encouraging users to drop down to raw SVG<text>and<line>elements for more control.Technical Details
Plox.Helpers.Axismodulex_labels: component for rendering labels for a givenPlox.XAxisy_labels: component for rendering labels for a givenPlox.YAxisPlox.Helpers.Gridmodulevertical_lines: component for rendering vertical lines from the top of the graph area to the bottomhorizontal_lines: component for rendering horizontal lines from the left of the graph area to the rightPlox.Constantsmodule:svg_presentation_attrs/0anddefault_label_gap/0@svg_presentation_globalsmodule attributex_axis_labelsandx_axis_labelcomponentsy_axis_labelsandy_axis_labelcomponentsx_axis_grid_linesandx_axis_grid_linecomponentsy_axis_grid_linesandy_axis_grid_linecomponentsscale_values/2above_graph/2below_graph/2left_of_graph/2right_of_graph/2graph_top/2graph_bottom/2graph_left/2graph_right/2