OxyPlot:如何隐藏左侧和顶部轴线

OxyPlot: how to hide left and top axis lines

我正在为我的 Xamarin.iOS 项目使用 Oxyplot 来绘制条形图

这是我的情节目前的样子

这里我需要隐藏右轴和上轴

我试过了:

model.Axes.Add(new LinearAxis()
{
    Position = AxisPosition.Right,
    IsAxisVisible = false
});
model.Axes.Add(new LinearAxis()
{
    Position = AxisPosition.Top,
    IsAxisVisible = false
});

但没有效果..这是我的完整代码

public MyClass()
{
    var model = new PlotModel { Title = "ColumnSeries" };
    // A ColumnSeries requires a CategoryAxis on the x-axis.

    model.Axes.Add(new CategoryAxis()
    {
        Position = AxisPosition.Bottom,
        MinorTickSize = 0,
        //MajorGridlineStyle = LineStyle.Solid,
        MinorGridlineStyle = LineStyle.Solid,
    });

    model.Axes.Add(new LinearAxis()
    {
        Position = AxisPosition.Left,
        MinorTickSize = 0,
        MajorGridlineStyle = LineStyle.Solid,
        MinorGridlineStyle = LineStyle.Solid,
        Minimum = 0,
        Maximum = 400
    });
    model.Axes.Add(new LinearAxis()
    {
        Position = AxisPosition.Right,
        IsAxisVisible = false
    });
    model.Axes.Add(new LinearAxis()
    {
        Position = AxisPosition.Top,
        IsAxisVisible = false
    });

    var series = new ColumnSeries();
    series.Items.Add(new ColumnItem() { Value = 200});
    series.Items.Add(new ColumnItem(200));
    series.Items.Add(new ColumnItem(300));
    series.Items.Add(new ColumnItem(100));
    series.Items.Add(new ColumnItem(200));
    series.Items.Add(new ColumnItem(100));
    series.Items.Add(new ColumnItem(130));

    model.Series.Add(series);

    this.MyModel = model;
}

我该怎么做?感谢您的帮助....

编辑:

另外,在我上面的图表中,为什么没有显示 y 标签。我怎样才能像下面这样更改 x 标签...是否可以像下面这样在这个图表中画线?

这就是我想要的最终图形:

问题是你现在看到的黑色边框不是坐标轴,是plot area border,所以你要在plotmodel中修改这个属性:

model.PlotAreaBorderColor = OxyColors.Transparent;

然后,您必须将 AxisLineStyle 添加到要绘制的轴(左侧和底部),如下所示:

model.Axes.Add(new LinearAxis()
{
    AxislineStyle = LineStyle.Solid,

    Position = AxisPosition.Left,
    MinorTickSize = 0,
    MajorGridlineStyle = LineStyle.Solid,
    MinorGridlineStyle = LineStyle.Solid,
    Minimum = 0,
    Maximum = 400
});