Skip to content

Commit

Permalink
Updated AxisType.Numeric to used FixedInterval ITickGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
erichiller committed Feb 12, 2024
1 parent eafd952 commit 651f5ef
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/PlotGitHubAction/PlotGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,15 @@ 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,
// LabelFormatter = static v => $"{v:n0}"
},
_ => ( 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 651f5ef

Please sign in to comment.