Skip to content
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

fix: missing sign on alignment graph offset axis #20

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions AudioAlign/AlignmentGraphWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,28 @@ double maxIntervalSize
interval = nextInterval;
}
}

/// <summary>
/// Adds missing negative signs to axis labels when a custom format is used.
///
/// The axis formatter converts the `double`-parameter to a `TimeSpan` and formats
/// it with `string.Format`. By default, when no custom format is specified, it adds
/// the negative sign to negative time spans.
/// When specifying a custom format, the negative sign is no longer added (only to time
/// spans; it is still added to other types), so it needs to be additionally added
/// to the formatted string.
/// </summary>
protected override string FormatValueOverride(double x)
{
var format = base.FormatValueOverride(x);

if (StringFormat != null && x < 0)
{
format = "-" + format;
}

return format;
}
}
}
}
Loading