资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

XamaminiOS中如何使用OxyPlotiO框架绘制线图-创新互联

小编给大家分享一下Xamamin iOS中如何使用OxyPlotiO框架绘制线图,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

创新互联建站-专业网站定制、快速模板网站建设、高性价比行唐网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式行唐网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖行唐地区。费用合理售后完善,10多年实体公司更值得信赖。
Xamamin iOS中绘制线图OxyPlotiOSDemo

【示例OxyPlotiOSDemo】下面将实现线图的显示。具体的操作步骤如下:

(1)打开Xamarin.iOS项目。

(2)将OxyPlot.Xamarin.iOS组件添加到项目中的引入中。

(3)打开ViewController.cs文件,完成剩余的步骤,即创建PlotView视图、绘制图表、设置显示模式以及显示PlotView。代码如下:

using Foundation;
using System;
using UIKit;
using OxyPlot.Xamarin.iOS;
using OxyPlot;
using OxyPlot.Axes;
using OxyPlot.Series;
namespace OxyPlotiOSDemo
{
    public partial class ViewController : UIViewController
    {
        public ViewController (IntPtr handle) : base (handle)
        {
        }
        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();
            // Perform any additional setup after loading the view, typically from a nib.
            //创建PlotView视图
            PlotView plotView = new PlotView
            {
                Frame = this.View.Frame
            };
            plotView.Model=CreatePlotModel();                                                    //设置显示模式
            this.View.Add(plotView);                                                                        //将PlotView视图添加到主视图上
        }
        //绘制图表
        private PlotModel CreatePlotModel()
        {
            //创建图表模式
            var plotModel = new PlotModel
            {
                Title = "OxyPlot Demo"
            };
            //添加坐标轴
            plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
            plotModel.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Maximum = 10, Minimum = 0 });
            //创建数据列
            var series1 = new LineSeries
            {
                Title = "Data",
                MarkerType = MarkerType.Circle,
                MarkerSize = 4,
                MarkerStroke = OxyColors.White
            };
            //添加数据点
            series1.Points.Add(new DataPoint(0.0, 6.0));
            series1.Points.Add(new DataPoint(1.4, 2.1));
            series1.Points.Add(new DataPoint(2.0, 4.2));
            series1.Points.Add(new DataPoint(3.3, 2.3));
            series1.Points.Add(new DataPoint(4.7, 7.4));
            series1.Points.Add(new DataPoint(6.0, 6.2));
            series1.Points.Add(new DataPoint(8.9, 8.9));
            //添加数据列
            plotModel.Series.Add(series1);
            return plotModel;
        }
        ……
    }
}

运行程序,会看到如图1.2所示的效果。

 Xamamin iOS中如何使用OxyPlotiO框架绘制线图

图1.2  Xamarin.iOS平台的线图效果

以上是“Xamamin iOS中如何使用OxyPlotiO框架绘制线图”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联-成都网站建设公司行业资讯频道!


本文题目:XamaminiOS中如何使用OxyPlotiO框架绘制线图-创新互联
网站路径:http://cdkjz.cn/article/pehii.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220