如何改变OxyPlot Y轴字符串格式? [英] How to change OxyPlot Y-Axis string format?
本文介绍了如何改变OxyPlot Y轴字符串格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能告诉我如何改变Y轴字符串格式??
我有Y轴的百分数,我想添加百分号。。p>
我使用OxyPlot生产WPF中的图表
下面是我的尝试,但它不工作:
Func键<双,串> formatFunc =(X)=>的String.Format({} 000.00%,X);
formatFunc =新Func键与LT;双,串>({0});
//添加情节窗口
line.YAxis.LabelFormatter = formatFunc;
这会产生空引用错误。
!谢谢
解决方案
这是我以前用来格式化上的氧情节x轴的例子:
VAR XAXIS =新的DateTimeAxis
{
位置= AxisPosition.Bottom,
的StringFormat =DD / MM / YYYY,
标题=日结束,
IntervalLength = 75,
MinorIntervalType = DateTimeIntervalType.Days,
IntervalType = DateTimeIntervalType.Days,
MajorGridlineStyle = LineStyle.Solid,
MinorGridlineStyle = LineStyle.None,
};
地块=新PlotModel();
Plot.Axes.Add(X轴);
Can anyone tell me how to change the Y axis string format??
I have Y-Axis percentages that I want to add the percent sign to.
I am using OxyPlot to produce the chart in wpf.
Here is my attempt, but it is NOT working:
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;
This produces null reference error.
Thanks!
解决方案
This is an example I've used previously to format the x-axis on an oxy-plot:
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);
这篇关于如何改变OxyPlot Y轴字符串格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文