0

I can't manage to set the xAxis properly I would like interval increasing by 0.5:

|--|----|---|
0  0.5  1  1.5  and so on

I use this:

PositionModel.Axes.Add(new CategoryAxis { 
    Position = AxisPosition.Bottom, Minimum = 9,
    Maximum = 28,
    Key = "XAsis", 
    MajorStep = 1, // useless ?
    MinorStep = 0.5  // useless ?
});

But this code doesn't produce the desired result (increasing by 1 instead).

Besides I don't really know what exactly Marjor/MinorStep is.

Documentation is really really light... unfortunatly

PS: I am really upset to see negative vote without explanation

Guillaume Paris
  • 10,303
  • 14
  • 70
  • 145
  • Please tell me why negative vote, I will update my message accordingly – Guillaume Paris Jul 24 '17 at 15:37
  • 1
    Its bad that your question got downvoted, but to answer your question: I don't think you need to explicitly mention the `interval`. Just start plotting the values and Oxyplot will automatically do it for you. `MajorStep` is the maximum allowed interval and `MinorStep` is the minimum allowed interval – boop_the_snoot Jul 24 '17 at 16:21

1 Answers1

2

You should use Axis instead of CategoryAxis which provide following two extra properties LabelField and ItemsSource that enable user to custom axis label; and thus render the MinorStep property in CategoryAxis useless and is hard-coded to 1.

You can still accomplish what you want provided you add LabelField/ItemsSouce properties with proper data, but it is much simpler by using Axis.

For reference, have a look at the source code at : https://github.com/oxyplot/oxyplot/blob/develop/Source/OxyPlot/Axes/CategoryAxis.cs

Peter
  • 1,048
  • 10
  • 23