-
Notifications
You must be signed in to change notification settings - Fork 6
Axis and Grid Helpers #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: philosophical-rewrite
Are you sure you want to change the base?
Axis and Grid Helpers #24
Conversation
2aceb5b to
38f4b03
Compare
a5c5473 to
5ecdd91
Compare
There was a problem hiding this 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
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>
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