如何更改OxyPlot Y-Axis字符串格式?

Joh*_*ust 3 c# wpf oxyplot

谁能告诉我如何更改Y轴字符串格式?

我有Y轴百分比,我想添加百分号.

我正在使用OxyPlot在wpf中生成图表.

这是我的尝试,但它不起作用:

Func<double, string> formatFunc = (x) => string.Format("{000.00}%", x);

        formatFunc = new Func<double,string>("{0}");
        // Add the plot to the window
        line.YAxis.LabelFormatter = formatFunc;
Run Code Online (Sandbox Code Playgroud)

这会产生空引用错误.

谢谢!

Awk*_*der 5

这是我之前用于在氧图上格式化x轴的示例:

var xAxis = new DateTimeAxis
{
    Position = AxisPosition.Bottom,
    StringFormat = "dd/MM/yyyy",
    Title = "End of Day",
    IntervalLength = 75,
    MinorIntervalType = DateTimeIntervalType.Days,
    IntervalType = DateTimeIntervalType.Days,
    MajorGridlineStyle = LineStyle.Solid,
    MinorGridlineStyle = LineStyle.None,
};

Plot = new PlotModel();
Plot.Axes.Add(xAxis);
Run Code Online (Sandbox Code Playgroud)