问题
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>
回答1:
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.
回答2:
Use the IsAxisVisible property.
In XAML:
<oxy:LinearAxis IsAxisVisible="False"/>
In C#:
plot.Axes[0].IsAxisVisible = false;
来源:https://stackoverflow.com/questions/37683644/oxyplot-how-to-remove-axes