WPF中的对数图
本文关键字:WPF | 更新日期: 2023-09-27 17:59:41
我想在WPF中创建一个对数图。X轴范围为10到20000,Y轴范围为-20到20。X轴的划分并不均匀,它们是基于一些对数公式。由于我是WPF的新手,我不知道哪种方法适合在WPF中创建图。WPF中是否有任何控件可用于创建对数图,或者是否有其他解决方案可用于绘制对数图?
wpf工具箱中有许多图表控件。其他自定义构建图表也可用。请浏览下面的链接
https://code.msdn.microsoft.com/windowsapps/Chart-Control-in-WPF-c9727c28
http://www.codeproject.com/Articles/196502/WPF-Toolkit-Charting-Controls-Line-Bar-Area-Pie-Co
http://blogs.msdn.com/b/torstenmandelkow/archive/2013/05/06/free-modernui-charts-for-wpf-windows-store-apps-und-silverlight-published.aspx
查看氧合图。它支持对数绘图。https://github.com/ylatuya/oxyplot/tree/master/Source/OxyPlot.Wpf.
以下是一些使用Oxyplot的ExampleBrowser生成的示例代码(强烈推荐!!),该代码也可通过GitHub获得。
[Example("Untitled")]
public static PlotModel Untitled()
{
var plotModel1 = new PlotModel();
var logarithmicAxis1 = new LogarithmicAxis();
logarithmicAxis1.Maximum = 1000000;
logarithmicAxis1.Minimum = 1;
logarithmicAxis1.Title = "Log axis";
logarithmicAxis1.UseSuperExponentialFormat = true;
plotModel1.Axes.Add(logarithmicAxis1);
var logarithmicAxis2 = new LogarithmicAxis();
logarithmicAxis2.Maximum = 10000;
logarithmicAxis2.Minimum = 0.001;
logarithmicAxis2.Position = AxisPosition.Bottom;
logarithmicAxis2.Title = "Log axis";
logarithmicAxis2.UseSuperExponentialFormat = true;
plotModel1.Axes.Add(logarithmicAxis2);
return plotModel1;
}