Skip to content

fix: invert y-axis label row index to match plot orientation#112

Merged
meszmate merged 1 commit into
mainfrom
fix/reverse-y-axis-labels
May 28, 2026
Merged

fix: invert y-axis label row index to match plot orientation#112
meszmate merged 1 commit into
mainfrom
fix/reverse-y-axis-labels

Conversation

@meszmate

@meszmate meszmate commented May 28, 2026

Copy link
Copy Markdown
Owner

Fixes #110.

Summary

  • The plot is rendered top→bottom, but TickSet.updatePositions stored tick positions using mapToResolution directly, which puts the smallest value at position 0. mapY (used for drawing the data) flips the coordinate so the largest value lands at screen row 0, leaving the y-axis labels mirrored relative to the plot.
  • renderPlotRow now looks up the tick label by plot_height - 1 - row_index, matching the rendered plot orientation (largest value at top, smallest at bottom).
  • Drops the _ = plot_height discard now that the parameter is used.

Test plan

  • zig build run-charts (or equivalent) and confirm y-axis labels are ordered largest at top, smallest at bottom.
  • Charts with show_labels = false still render unchanged.

@meszmate meszmate merged commit e16e252 into main May 28, 2026
9 checks passed
@meszmate meszmate deleted the fix/reverse-y-axis-labels branch May 28, 2026 05:45
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.

Reverse Y Axis in Charts

2 participants