Georgiana M
Georgiana M

Reputation: 431

How to set OxyPlot origin in top left corner?

I create a OxyPlot plot with 20 series. Each series represents a channel. The origin is now at bottom left corner.

See picture bellow:

enter image description here

I would like to have them order from top to bottom. How to set OxyPlot origin in top left corner?(See picture bellow)

enter image description here

Upvotes: 2

Views: 1040

Answers (2)

Georgiana M
Georgiana M

Reputation: 431

I recently found a within Oxyplot Axis configuration propriety StartPosition that is supposed to get and set the start position of the axis.

enter image description here

However I did not figure it out if this would change the orientation of the origin point.

I came up with a different solution, I decided to plot them reversely and use a CategoryAxis for the left axis and set the labels in a descending order.

plotModel.Axes.Add(new LinearAxis
{
    Position = AxisPosition.Bottom,
    MajorTickSize = 0,
    MinorTickSize = 0
});

plotModel.Axes.Add(new CategoryAxis
{
    Position = AxisPosition.Left,
    Title = MyTitle,
    MajorTickSize = 0,
    MinorTickSize = 0,
    LabelField = "LabelChannels",
    Labels = 
    {   "20",
        "19",
        ...
        "3",
        "2",
        "1",
    }
});

It would be nice though to know if there is any other way, much simpler than what I did.

Upvotes: 0

Magnetron
Magnetron

Reputation: 8543

I know this is old, but you just had to set the Axis StartPosition to 1 and the EndPosition to 0

CategoryAxis myAxis = new CategoryAxis();
myAxis.StartPosition = 1;
myAxis.EndPosition = 0;

Upvotes: 2

Related Questions