Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
- Example to Show/Hide Legend (#1470)
- Example of BarSeries stacked and with labels (#1979)
- Example of issue with AreaSeries tracker (#1982)
- Example for CategoryAxis with custom MajorStep and uncentered ticks (#1971)
- BarSeries.LabelAngle property (#1870)

### Changed
Expand Down
14 changes: 13 additions & 1 deletion Source/Examples/ExampleLibrary/Axes/CategoryAxisExamples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ public static PlotModel ItemsSourceValues()

[Example("MajorStep")]
public static PlotModel MajorStepCategoryAxis()
{
var plotModel1 = new PlotModel { Title = "Major Step = 4, IsTickCentered = false" };
var catAxis = new CategoryAxis { IsTickCentered = false, MajorStep = 4 };
catAxis.Labels.AddRange(new[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" });
plotModel1.Axes.Add(catAxis);
var linearAxis = new LinearAxis { Position = AxisPosition.Left };
plotModel1.Axes.Add(linearAxis);
return plotModel1;
}

[Example("MajorStep, TickCentered")]
public static PlotModel MajorStepCategoryTickCenteredAxis()
{
var plotModel1 = new PlotModel { Title = "Major Step = 4, IsTickCentered = true" };
var catAxis = new CategoryAxis { IsTickCentered = true, MajorStep = 4 };
Expand All @@ -64,4 +76,4 @@ public static PlotModel MajorStepCategoryAxis()
return plotModel1;
}
}
}
}
2 changes: 1 addition & 1 deletion Source/OxyPlot/Axes/CategoryAxis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public override void GetTickValues(

if (mv.Count > 0)
{
var lastTick = mv[mv.Count - 1] + 1;
var lastTick = mv[mv.Count - 1] + this.MajorStep;
if (lastTick < this.ClipMaximum + epsilon)
{
mv.Add(lastTick);
Expand Down