OxyPlot - How to remove Axes

末鹿安然 提交于 2020-04-30 07:43:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!