2

I would like to create an Oxyplot view without any axes visible.

Could anyone tell me how to do so?

To avoid missunderstandings, I never added any axes to the plotmodel.

This code adds axes already. How to avoid that they are shown?

C#

        plot = new PlotModel();
        var ser = new LineSeries();
        ser.Points.Add(new DataPoint(1, 1));
        plot.Series.Add(ser);

XAML

<oxy:PlotView Background="Transparent" Model="{Binding plot}"</oxy:PlotView>

enter image description here

user2799180
  • 719
  • 1
  • 11
  • 29

2 Answers2

4

As stated in in oxyplot axes documentation:

If no axes are defined, linear axes will be added to the bottom and left.

So, as @JohnStrit said, you have to add "invisible" axis to your plot model, like that:

plot.Axes.Add(new LinearAxis()
{
    Position = AxisPosition.Bottom,
    IsAxisVisible = false
});

plot.Axes.Add(new LinearAxis()
{
    Position = AxisPosition.Left,
    IsAxisVisible = false
});

I've checked out this way and it works.

Community
  • 1
  • 1
Jose
  • 1,857
  • 1
  • 16
  • 34
  • Works. I guess this is a bug but if I set Position = AxisPosition.None. I get the axes anyway. This is actually why it was not working for me. Thanks! – user2799180 Jun 14 '16 at 21:34
1

Use the IsAxisVisible property.

In XAML:

<oxy:LinearAxis IsAxisVisible="False"/>

In C#:

plot.Axes[0].IsAxisVisible = false;
John Stritenberger
  • 1,194
  • 1
  • 12
  • 30
  • Thanks for your answer but I never added an axis, so I can not set its visibility to false. – user2799180 Jun 10 '16 at 07:09
  • Without getting crazy with it, a good solution would be to add some axes to your plot. It would give you full control over their behavior, but still maintain the cool OxyPlot functionality of zoom, pan, etc. in your plot. – John Stritenberger Jun 10 '16 at 12:20
  • How to do that? I can add axes to the plotmodel but if I tell them to not be visible, oxyplot creates the same one like if there would not be any axes bound to the plotmodel – user2799180 Jun 10 '16 at 12:31