Skip to content

Improve line track Y-axis scale#924

Open
Sajeeth-Wimalasuriyan wants to merge 2 commits into
mainfrom
sw-y-axis-improvements
Open

Improve line track Y-axis scale#924
Sajeeth-Wimalasuriyan wants to merge 2 commits into
mainfrom
sw-y-axis-improvements

Conversation

@Sajeeth-Wimalasuriyan

Copy link
Copy Markdown
Contributor
image Added y axis labels that get generated or removed as graph is adjusted in size.

Add tick marks, a centered middle value, and horizontal grid lines to line tracks. Interior values scale with track height and stay symmetric about the center; interior ticks, labels, and grid lines are hidden on short tracks.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment on lines +156 to +162
// Grid lines behind the data, matching the meta-area ticks.
if(m_track_height >= Y_AXIS_LABEL_MIN_TRACK_HEIGHT)
{
std::vector<double> grid_ticks;
GenerateYAxisTicks(content_size.y, grid_ticks);
const ImU32 grid_color =
ApplyAlpha(m_settings.GetColor(Colors::kGridColor), Y_AXIS_GRID_LINE_ALPHA);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

grid_ticks - make this a member m_grid_ticks - so it doesn't have to be re-created each frame...

Then call GenerateYAxisTicks(content_size.y, grid_ticks); only if track size changed..

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also however grid_color is calculated, maybe the alpha? isn't quite right..

The horizontal lines are brighter than the vertical grid lines.. I think they should be the same..

Image

@tomk-amd

tomk-amd commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Also, a nitpik:

The inner (generated) numbers on the axis are mis-aligned compared to the min / max in the horizonal direction, they touch the divider line:

image

Cache generated ticks and align the new scale with the timeline grid.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

2 participants