Skip to content

Commit

Permalink
Updated AxisType.Numeric ITickGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
erichiller committed Feb 12, 2024
1 parent eafd952 commit 0954500
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/PlotGitHubAction/PlotGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ private static void createPlot( string jsonString, string plotDefinitionsDir ) {
* Y-Axis Tick Generator
*/

Func<double, string>? tickGen = config.YAxisType switch {
AxisType.Percent => static v => $"{v:p1}",
AxisType.Numeric => static v => $"{v:n0}",
_ => null
};
if ( tickGen is { } ) {
// plt.Axes.
plt.Axes.Left.TickGenerator = new ScottPlot.TickGenerators.NumericAutomatic { LabelFormatter = tickGen };
if ( config.YAxisType switch {
AxisType.Percent => new ScottPlot.TickGenerators.NumericAutomatic { LabelFormatter = static v => $"{v:p1}" },
// AxisType.Numeric => new ScottPlot.TickGenerators.NumericFixedInterval { Interval = 1 },
// https://github.com/ScottPlot/ScottPlot/blob/main/src/ScottPlot5/ScottPlot5/TickGenerators/NumericAutomatic.cs
AxisType.Numeric => new ScottPlot.TickGenerators.NumericAutomatic { IntegerTicksOnly = true },
_ => ( ITickGenerator? )null
} is { } tickGenerator ) {
plt.Axes.Left.TickGenerator = tickGenerator;
}

// If the Y-Axis is a Percentage, constrain bounds to 0-100
Expand Down

0 comments on commit 0954500

Please sign in to comment.