Xamarin Android - Oxyplot,隐藏轴值

Xamarin Android - Oxyplot, hide axis values

我正在开发一个 xamarin android 应用程序,我正在使用 oxyplot 来显示图表。这是oxyplot

的代码
        OxyPlot.Axes.CategoryAxis xaxis = new OxyPlot.Axes.CategoryAxis();
        xaxis.Position = AxisPosition.Bottom;
        xaxis.TextColor = OxyColors.Transparent;
        xaxis.IsPanEnabled = false;
        xaxis.IsAxisVisible = false;
        xaxis.MinorTickSize = 0;
        xaxis.MajorGridlineStyle = LineStyle.None;
        xaxis.MinorGridlineStyle = LineStyle.None;
        xaxis.IsZoomEnabled = false;
        xaxis.IsPanEnabled = false;


        LinearAxis yaxis = new LinearAxis();
        yaxis.Position = AxisPosition.Left;
        yaxis.TextColor = OxyColors.Transparent;
        yaxis.IsPanEnabled = false;
        yaxis.IsAxisVisible = false;
        yaxis.MinorTickSize = 0;
        yaxis.MajorGridlineStyle = LineStyle.None;
        yaxis.MinorGridlineStyle = LineStyle.None;
        yaxis.IsZoomEnabled = false;
        yaxis.IsPanEnabled = false;

        OxyPlot.Series.ColumnSeries s1 = new OxyPlot.Series.ColumnSeries();
        //s1.IsStacked = true;
        s1.Items.Add(new ColumnItem(100));
        s1.Items.Add(new ColumnItem(55));



        var model = new PlotModel();
        model.Background = OxyColors.White;
        model.PlotAreaBorderColor = OxyColors.Transparent;

        model.Series.Add(s1);
        model.IsLegendVisible = false;

        return model;

这是我 phone

中的输出

问题是我想隐藏除两个栏之外的所有内容。隐藏轴的线和值。非常感谢。

documentation中所述:

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

您还没有为您的模型设置这两个轴,所以它添加了两个默认轴。 您可以尝试使用以下代码添加坐标轴:

//...
//Your other code
//....

var model = new PlotModel();
model.Background = OxyColors.White;
model.PlotAreaBorderColor = OxyColors.Transparent;

//Add axes
model.Axes.Add(xaxis);
model.Axes.Add(yaxis);

model.Series.Add(s1);
model.IsLegendVisible = false;