簡體   English   中英

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

[英]How to change OxyPlot Y-Axis string format?

誰能告訴我如何更改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;

這會產生空引用錯誤。

謝謝!

這是我之前用於在氧圖上格式化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);
        this._PlotModel.Axes.Add( new LinearAxis
        {
            Position = AxisPosition.Left,
            Minimum = 0.025,
            Maximum = 0.205,
            StringFormat = "0.00%",
            MajorStep = 0.005
        } );

- 添加百分比作為比例:20.5% - > 0.205,0.5% - > 0.005等。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM