Skip to content

Commit 907aa7d

Browse files
rebelinuxCopilot
andauthored
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 904eae5 commit 907aa7d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Sources/BarChart.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,16 @@ public object Chart(double[] values, string[] labels, string filename = "output"
210210
// Value is on the X-axis for horizontal orientation
211211
double xMin = Math.Min(0, singleValue) - padding;
212212
double xMax = Math.Max(0, singleValue) + padding;
213-
myPlot.Axes.SetLimits(xMin, xMax, -2, 2);
213+
// Use ±0.5 on the category (Y) axis to match bar index spacing for a single bar
214+
myPlot.Axes.SetLimits(xMin, xMax, -0.5, 0.5);
214215
}
215216
else
216217
{
217218
// Value is on the Y-axis for vertical orientation
218219
double yMin = Math.Min(0, singleValue) - padding;
219220
double yMax = Math.Max(0, singleValue) + padding;
220-
myPlot.Axes.SetLimits(-2, 2, yMin, yMax);
221+
// Use ±0.5 on the category (X) axis to match bar index spacing for a single bar
222+
myPlot.Axes.SetLimits(-0.5, 0.5, yMin, yMax);
221223
}
222224
}
223225

0 commit comments

Comments
 (0)