Skip to content

feat(pulse): add a second Y axis on the right - #39

Merged
ingvarch merged 1 commit into
mainfrom
feat/right-axis
Nov 9, 2026
Merged

ingvarch merged 1 commit into
mainfrom
feat/right-axis

Conversation

@ingvarch

@ingvarch ingvarch commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Description

Adds a second Y axis on the right, so two metrics on different scales, such as CPU in percent and requests per second, share one chart.

  • Axis{Min, Max, Ticks, Formatter}, WithRightAxis / SetRightAxis / RightAxis(), WithSeriesRightAxis / SetSeriesRightAxis / SeriesRightAxis(). NaN and infinite bounds are ignored, as in SetRange.
  • Every line of View gets one cell for the right axis line plus a label column as wide as the widest right label. The plot stays w wide, the height does not change, and the time axis rows keep their alignment (the axis row ends with ┘).
  • Right labels sit on the rows of their own ticks; the grid follows the left ticks.
  • Legend and LegendBox mark right-axis series with →.
  • Auto range, the zero baseline, the symmetric range, thresholds, threshold colors and negative styles stay on the left axis.
  • View maps right-axis series into the left drawing space (also on a log scale) and gives renderers a wrapped Chart; RenderContext.RightAxis marks those series. The Chart interface does not change.
  • New section "Right Axis" in docs/axes-and-grid.md with the rightaxis screenshot.

Decision on the open question:

  • The right labels stay on their own tick rows instead of the left tick rows, so they stay round numbers.

Issues

Closes #12

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement / Refactoring

Checklist

  • I have read the CONTRIBUTING.md guide.
  • My code adheres to the project's code style and conventions (gofmt, go vet).
  • I have added tests that prove my fix is effective or that my feature works.
  • All existing and new tests pass (go test -race ./...) and everything builds (go build ./... and go -C examples build ./...).
  • I have updated any relevant documentation.

WithRightAxis adds a right Y axis with its own range, ticks and formatter, and
WithSeriesRightAxis plots a series against it. Right labels sit on the rows of
their own ticks; the grid follows the left ticks. The legend marks right-axis
series with an arrow. Auto range, thresholds and negative styles stay on the
left axis.

Closes #12
@ingvarch ingvarch added the enhancement New feature or request label Nov 9, 2026
@ingvarch
ingvarch merged commit d3c3396 into main Nov 9, 2026
2 checks passed
@ingvarch
ingvarch deleted the feat/right-axis branch November 9, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: second Y axis on the right

1 participant